aspose file tools*
The moose likes JSF and the fly likes ValueChangeListeners in DataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "ValueChangeListeners in DataTable" Watch "ValueChangeListeners in DataTable" New topic
Author

ValueChangeListeners in DataTable

Sam Sahu
Greenhorn

Joined: Oct 13, 2006
Posts: 1
Hi All,

I have a scenario wherein a drop down menu (selectOneMenu) is appearing within a data table. Apparently it displays as many drop downs at run time as there are the number of objects in the collection binded to the data table.

However, a valueChangeListener is also associated with the drop down appearing within the data table. For ex - If the data table's collection has 3 objects, then as many drop downs will be visible to the user. Now the action on value change depends on which drop down in the list has been operated upon.

Since, the source for the drop down is written only once within the datatable block with one unique id, How can the source of value change be determined from the list of drop down menus.

Will appraciate any help or pointers in this regard.

Regards,
Sambit
jununi
Greenhorn

Joined: Mar 28, 2006
Posts: 1
There shouldn't be any problem, your data model is binded to data table. Have a value attribute for each row in collection's Transfer Object along with setter/getter. It will set the selected value in the TO of the proper selected data table row at the submission of the form.

but, if you still like to do some manual work, you could retrieve the changed value in the valueChangeListener then get the data model row index and set the value in the corresponding attribute. You may have to submit onchange for selectOneMenu to be able to do this.


Originally posted by Sam Sahu:
Hi All,

I have a scenario wherein a drop down menu (selectOneMenu) is appearing within a data table. Apparently it displays as many drop downs at run time as there are the number of objects in the collection binded to the data table.

However, a valueChangeListener is also associated with the drop down appearing within the data table. For ex - If the data table's collection has 3 objects, then as many drop downs will be visible to the user. Now the action on value change depends on which drop down in the list has been operated upon.

Since, the source for the drop down is written only once within the datatable block with one unique id, How can the source of value change be determined from the list of drop down menus.

Will appraciate any help or pointers in this regard.

Regards,
Sambit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ValueChangeListeners in DataTable