Monday, May 16, 2011

To reset the sorting column in rich:dataTable

public void resetTableSorting() {
UIDataTable table = (UIDataTable) FacesContext.getCurrentInstance().getViewRoot()
.findComponent("FormName:TableName" );
resetSorting( table );
}
public void resetSorting( UIDataTable table ) {
if ( table != null ) {
List uiComponentBase = (List) table.getChildren();
for ( UIComponent column : uiComponentBase ) {
( (UIColumn) column ).setSortOrder( Ordering.UNSORTED );
}
}
}

No comments:

Post a Comment