0
votes

In Primefaces DataTable script to get current page row count WidgetVar.paginator.cfg.rowCount it show all rows count but I need current page row count (i.e) first page 20 records and second as 3 records when I click paginator for 2 second I need result 2 second page row count result 3.

<p:ajax event="page" oncomplete="getRowCount();"/>
1

1 Answers

0
votes

This can be done with some small client side jquery javascript where you count the number of <tr> tags in the datatable data <tbody>

Try this

console.log($('#form\\:carTable_data').children());

#form:carTable_data is the full id of the corresponding body in the lazy loading showcase where the id of the datatable is carTable and the data body gets _data appended to it. In jquery the : needs to be escaped with a double backslash if the : is an actual part of the id. Otherwise it is interpreted as a pseudoselector.