Hi Jeroen
 
If I do this I get the value for ${item.trxDate}in the flowscript. But I
would need the value for id (=${counter}).
One solution I found is to add a hidden column:
 
<td style="display: none">
  <ft:widget id="selectedRow" />
</td>
 
Add an 'onclick' value in the data part:

<td onclick="submitId(${counter})"> 
  ${item.trxDate}
</td>
...
 

And a javaScript function:

function submitId(id) {
  var widget = document.getElementById('selectedRow');
  widget.value = id;
  document.activityFollowup.submit();
}


In the flowscript I created a databinding. So I can save the
value from the 'selectedRow'-Widget:

form.save(filter);

and get it by

filter.getSelectedRow();


I know it is rude, but it works...


Regards,
Roland Seiler

________________________________

Von: Jeroen Reijn [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 31. Oktober 2006 18:17
An: [email protected]
Betreff: RE: How to detect which row in the table was klicked?


Hi Roland,
 
I think that for the submitId to work, you need to define the submit widget
in your model. Since you're iterating throught flowscript, can you just use
your request object to fetch the id or name of your submit button?
 
Try adding the name parameter to your submit type like:
 
 <input class="submitLink" type="submit" id="${counter}" name="submitbutton"
value="${item.trxDate} />
 
Now from your flowscript you can get the value of the submit button by using
the request object like:
 
var button_value = cocoon.request.get("submitbutton");
 
Kind regards,
 
Jeroen Reijn
Hippo

        -----Original Message-----
        From: Roland Seiler [mailto:[EMAIL PROTECTED]
        Posted At: Tuesday, October 31, 2006 4:35 PM
        Posted To: Cocoon User List
        Conversation: How to detect which row in the table was klicked?
        Subject: How to detect which row in the table was klicked?
        
        

        Hi all 

        I am a beginner in Cocoon and I try to do the following: 

        I have a search form which presents some results in a table. When i
press a row in the table, 
        a detail page appears. 

        Actually i do something like this: 
          
        flow: 
          // do search... 
          var trxList = ... 

          // show result form 
          form.showForm("activityFollowup.form", {trxList:trxList}); 

         // get the selected row 
         var id = form.submitId; 

          // and display the detail page 
         form.showForm("transactionDetail.form", {trx:trxList[id]}); 


        In the form definition I create the table like this: 

        <jx:set var="counter" value="#{0}"/> 

        <table id="resultTable" width="100%" border="0" cellspacing="0"> 
          <jx:forEach var="item" items="${trxList}"> 
            <jx:set var="counter" value="#{1 + $counter}"/> 

            <tr> 
              <td> 
                // represent the text as submit link to go back in the flow 
                <input class="submitLink" type="submit" id="${counter}"
value="${item.trxDate} /> 
              </td> 
               . 
               . 
               . 
            </tr> 
          </jx:forEach> 
        </table> 

        Back in the flowscript, unfortunately the submitId is null. How can
I detect 
        on which row the user klicked? 


        Regards, 
        Roland Seiler 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to