SelectableListTableContentProvider header order


I have a SelectableListTableContentProvider that the user can sort all values by selecting on headers, like this image (header1.png)

How can I restart this sorting, using a button action? I tried to set all values null or empty, but i got exception.


You would want to find the column controls and set the ordinal and ascending properties appropriately.

For example, something like this:

UIComponent component = findComponentInRoot("tableIdHere");
if (component instanceof UIData) {
	UIData dataTable = (UIData)component;
	//the column to make the primary sort column
	String idToSortBy = "columnIdHere";
	//which direction to order by
	boolean isAscending = true;
	for (Iterator<UIComponent> it = dataTable.getChildren().iterator(); it.hasNext();) {
		UIComponent child =;
		if (child instanceof IExtendedColumn) {
			IExtendedColumn column = (IExtendedColumn)child;
			if (idToSortBy.equals(child.getId())) {
				//make this the primary sort column
			} else {
				//don't sort by this column

Eric, thanks for reply.

No, I just want to set the header for original status. The values I will call a refresh action on my connector.


I’m not following what you are saying.

Can you provide any additional details?


Looking at the image, the user sorted all table values selecting on header.

Now, I have an action button that needs to clean this header selection and clean all values in table.

To clean all values that’s ok, but I don’t know how to clean the header selection.


That’s basically what the snippet I provided does. It will reset the sort/order state of the columns to make one of the columns the primary sort column and clear any sort state from the other columns.

I have put this code on the onClick action Button and didn’t work, the button have no more action

The code snippet I provided is server side java code that could be run in the action handler method for a command button.

The onClick value for a button is client-side javascript. The column sort state can not be changed for multiple columns at the same time from javascript.


It worked!!!

Thank you, Eric!

Eric, can I ask you one more thing?

It’s possible to select none values on table?

For example, I have selected some lines using checkbox, when I click on action button, all checkboxes needs to be cleared, like when I click on select none on “Select all rows checkbox”.


Sure. From the server-side java code, get your table content provider and call the API to set the selected row ids to an empty collection.

For example:


Or from client-side script code, get your table model and call the API to unselect all items :

var tableModel = CAF.model('#{caf:cid("yourTableId")}');





Hi Luis,

You can set the selected row ids to null using the table provider as shown below:

1 Like

It worked!
Thank you Eric and Prasad!!