Dynamic table with sort and pagination

Hi,
In this project, we need to generate a dynamic table with column sort and pagination.
How can I accomplish this using CAF?

Regards,

Hi Jose could you elaborate on what exactly is the Dynamic Table u are refereing to, Coz. in CAF, all tables are dynamic.
And for sorting click on Table columns Property>Sorting>Sort, select the variable value according to which the u want the column to be sorted.
For Pagination, table comes with default one. u can change it by choosing either 9,10, or 11 element under the Table inside the Palatte view.

Hi Pradeep,
First of all thanks for the reply.
What I mean by “dynamic table”, is that we will have for the same table, with different number of columns, depending on the users profile.
Basically what we will have, is something like this:
In the same portlet, one user can see this table with 5 columns, and another user can see the same table with 3 columns,and another one can see the same table with 11 columns, and so one…

Regards,

Hi Jose,

Were you able to get this working?

Cheers!
Hari

Hi Jose

Please tell how you have done this.
I have the exactly same requirement but table row are not getting populated in the UI .

private void populateHeader(String columns, AsyncTable table){
System.out.println(“populateHeader is called…”);
int size = columns.length;

	List<UIComponent> tblColumns = table.getChildren();
	while(!tblColumns.isEmpty()){
		tblColumns.remove(0);
	}
	
	HtmlTableColumn actionColumn = new HtmlTableColumn();
	tblColumns.add(actionColumn);
	
	String renderExpression = "#{not empty AccountFilterUIDefaultviewView.getRoutingTokenByRoutID.result.getRoutingTokenByRoutIDResponse.routingTokenDetails.o_row_data_list[0]}";
	ValueExpression renderValueExpression = getFacesContext().getApplication().getExpressionFactory().createValueExpression(getFacesContext().getELContext(), renderExpression, String.class);
	actionColumn.setValueExpression("rendered",renderValueExpression);
	
	for(int i=0; i<size;i++){
		HtmlTableColumn stdColumn = new HtmlTableColumn();
		stdColumn.setId("column_"+columns[i]+"_"+i);
		tblColumns.add(stdColumn);
		
		HtmlOutputText header = new HtmlOutputText();
		header.setValue(columns[i]);
		stdColumn.setHeader(header);
		
		HtmlOutputText content = new HtmlOutputText();
		String contentExpression = "#{row.o_column_data_array["+i+"]}";
		ValueExpression valueExpression = getFacesContext().getApplication().getExpressionFactory().createValueExpression(getFacesContext().getELContext(), contentExpression, String.class);
		content.setValueExpression("value", valueExpression);
		stdColumn.getChildren().add(content);
		stdColumn.setSort(contentExpression);
	}
}

Thanks
Manoj Kumar

Hi Jose and Hari,

Did you guys got any solution for this.

I am stuck at the sorting part.

Even though the sorting symbol is showing at the table column header. On clicking it refreshes the table. But table is not getting sorted.

if you have implemented this please let me know.