Hi all,

I am using the display tag for a paged and sortable table in a struts based
application.  The data source comes from a collection.

On my pages I use the struts html:multibox tag and its value is set to the
position in the collection that is the object used to generate the specific
row.  When submitted I can use this value to work on the object in the
collection that corresponds to the users selection.

However in my table I also have for each row an html:select tag which allows
the user to select something for each row in the table (this must have a
default value, so the user could just check some of the checkboxes and click
submit).  This is where my problem starts.

If there were 10 rows on a table and the user selected 3 checkboxes my array
in the form bean would be 3 in length for the checkboxes but the array for
the select submission would be 10 in length.  How I match the correct
checkbox submission to the correct select submission is my problem?  Any
ideas would be welcome?

I can solve it for just one page.  I write a scriptlet with an int counter
and every time the display tag writes a row I add 1.  I put this inside the
multibox tag and submit both this value and the collection location value.
E.g.  the values each multibox would submit would be
positionInCollection+IntCounterWhereinTable for example 2+4.  I can then
parse this String and use the IntCounterWhereinTable to match the correct
position in the array submitted from the select drop downs, thus I know
which value from the drop down would correspond to each of the checkboxes.
This solution doesn't work when I go to page 2 though or resort, as the
counter is not reset to 0.  If after every navigate on the table (e.g. sort
and change of page) I could reset this int counter in the jsp page to 0 and
then number each of the rows again from 0 this would be fine.  But I'm not
sure how to do this?

I cannot use javascript.

I'm finding this a very irritating problem so if anyone could please help me
- I would be very grateful.  

Here's hoping.

Regards,

Paul



-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to