Hi everyone,
I have a datatable with datascroller.
I`ve entended DataModel in order to get pagination from database.
Unfortunately program gets whole result count and page results twice.
My b.bean is like
public DataModel getTableModel() {
totalListSize = getTotalRowsCount();
List<AtpFare> pagedList = getPage(table.getFirst(), table.getRows(), atpFaresParametersBean.getOrderBy());
tableModel = new PagedListDataModel(pagedList, totalListSize, table.getRows());
return tableModel;
}
<rich:dataTable id="mytable" style="valignTopAlignCenter"
align="center" value="#{mainBean.atpFaresBean.tableModel}"
onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
var="atp" binding="#{mainBean.atpFaresBean.table}" rows="15">
<rich:column>
<f:facet name="header">
<h:outputText value="">Tariff<br/>Â </h:outputText>
</f:facet>
<h:outputText value="#{atp.tar_no}" />
</rich:column>
...................
...................
<rich:datascroller id="paginator" maxPages="25" for="mytable"
bypassUpdates="true" fastStep="50" ajaxSingle="true"
immediate="true" align="center" reRender="errorMessages"
onpagechange="javascript:Richfaces.showModalPanel('modalPanelLoading')"
oncomplete="javascript:Richfaces.hideModalPanel('modalPanelLoading')"
onbeforedomupdate="javascript:Richfaces.hideModalPanel('modalPanelLoading')"
binding="#{mainBean.atpFaresBean.dataScroller}">
</rich:datascroller>