• Post Reply Bookmark Topic Watch Topic
  • New Topic

richdata table and rows

 
Raj Shekar H
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using rich data table . I need to get total no. of rows using Javascript .

If I use (document.getElementById('XXXXXXXX').rows.length .. I am getting only rows of the first page .. Since I am using pagination .. Is there any way/Synax .. sothat I can get all the rows

Appreciate your help.

Thanks,
Rj
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you want, from the sound of it, is to be able to retrieve the total number of rows in the (sub)Model object that backs the dataTable. This problem has the same solution whether you are using rich:dataTable or the core h:dataTable.

Try something like this:


The rowCount attribute of tableModel may not be available if you used a raw collection such as a list or array for the dataTable value. If so, you'll need to explicitly construct a ListDataModel (or ArrayDataModel) to wrap the collection and present it as a backing bean property.

I use a variation of this when I have total rows in a table. I subclass the DataModel class of my choice to add totals as subclass properties.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!