• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ValueChangeListeners in DataTable

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic