• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ValueChangeListeners in DataTable

 
Sam Sahu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic