Please i need help for this problem,
I have a p:datatable in my xhtml like this:
Code: Select all
<p:dataTable id="table" binding="#{ManagedBean.dataTable}" />
Code: Select all
private DataTable dataTable;
public void generateDataTable()
{
dataTable = new DataTable();
HtmlOutputText hot = new HtmlOutputText();
hot.setValue(objeto.getTituloListado());
dataTable.setHeader(hot);
dataTable.setPaginator(true);
dataTable.setPaginatorPosition("top");
dataTable.setValueExpression("value", createValueExpression("#{FactoriaListado.objectList}", List.class));
dataTable.setVar("o");
dataTable.setPaginatorTemplate("{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}");
dataTable.setRowsPerPageTemplate("5,10,15");
dataTable.setEmptyMessage("No data");
dataTable.setRows(10);
//columns
for (Atribute atribute : atributeList) {
if(atribute.isRendered())
{
//Header
HtmlOutputText headerColumn = new HtmlOutputText();
headerColumn.setValue(atribute.getLabel());
//Column
Column column = new Column();
column.setHeader(headerColumna);
column.setSortBy("#{o."+atribute.getName()+"}");
column.setId("colAtributo_" + atribute.getName());
column.setRendered(true);
//Column value
HtmlOutputText columnValue = new HtmlOutputText();
columnValue.setValueExpression("value", createValueExpression("#{o."+atribute.getName()+"}", String.class));
column.getChildren().add(columnValue);
dataTable.getChildren().add(column);
}
}
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.addPartialUpdateTarget("table");
}
If I generate the table directly in xhtml no problem with paging.
I have using PrimeFaces 2.2RC.
Please help me.
Thanks!