• 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

how to get row data from datatable

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..I am new to primefaces...i am using an datatable and every row has a selectonemenu as an column....and i wants to get selected data on submit button...
any help???
Thanks in advance...
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your datatable needs to have an associated DataModel object. The DataModel was mandatory in JSF1, but in JSF2 a lot of people take the easy way out and pass vanilla arrays and collections to the dataTable instead. That's OK for display-only, but in your case, it's not enough.

It's not that hard to use a DataModel and you gain a key benefit. The DataModel wraps the underlying array, List or whatever and maintains a row cursor. When the user clicks on a button and that button's action method fires, the action method can invoke the getRowData() method to obtain the row data for the selected row from the DataModel.

Note that because the DataModel is retaining context between page requests, it has to be in a View or Session-scope object.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic