Reset RowCount for filter-enabled paginated lazy DataTable??
Posted: 07 Jan 2011, 05:20
Hi,
I've a p:DataTable that is lazy-loading, pagination-enabled, filter-enabled and sort-enabled for several columns.
I managed to allow the DataTable keeps re-execute the implemented load() method after user posted any new filtering/sorting parameters, therefore the records on the screen can be refreshed and updated.
As the pagination rendering is totally rely on the total number of record passed to the DataTable (i.e. setRowCount()), let the DataTable "knows" the correct and actual rowCount is critically important for a concise display.
In my case, due to the DataTable is pagination-enabled mixed with filtering-enabled, we can't get the total number of record simply from the ResultSet.size(), as it will be just the "rows" value set at the <p:dataTable rows="n">, so we need to launch another query to database for getting the actual record count for such filtering condition.
However, I have no idea where to reset the RowCount (i.e. setRowCount()) after a new filtering conditions comes.
I've tried to put setRowCount() inside the load() method but this way will mess up my DataTable result.
Apart from the implemented load() method, I have no idea that any other intrinsic methods will be executed also? So that I can put setRowCount() there. Or, any other workaround for this?
Thanks for your suggestion.
I've a p:DataTable that is lazy-loading, pagination-enabled, filter-enabled and sort-enabled for several columns.
I managed to allow the DataTable keeps re-execute the implemented load() method after user posted any new filtering/sorting parameters, therefore the records on the screen can be refreshed and updated.
As the pagination rendering is totally rely on the total number of record passed to the DataTable (i.e. setRowCount()), let the DataTable "knows" the correct and actual rowCount is critically important for a concise display.
In my case, due to the DataTable is pagination-enabled mixed with filtering-enabled, we can't get the total number of record simply from the ResultSet.size(), as it will be just the "rows" value set at the <p:dataTable rows="n">, so we need to launch another query to database for getting the actual record count for such filtering condition.
However, I have no idea where to reset the RowCount (i.e. setRowCount()) after a new filtering conditions comes.
I've tried to put setRowCount() inside the load() method but this way will mess up my DataTable result.
Apart from the implemented load() method, I have no idea that any other intrinsic methods will be executed also? So that I can put setRowCount() there. Or, any other workaround for this?
Thanks for your suggestion.