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 = it.next();
if (child instanceof IExtendedColumn) {
IExtendedColumn column = (IExtendedColumn)child;
if (idToSortBy.equals(child.getId())) {
//make this the primary sort column
column.setOrdinal(1);
column.setAscending(isAscending);
} else {
//don't sort by this column
column.setOrdinal(0);
}
}
}
}
#MWS-CAF-Task-Engine#webMethods-BPMS#webMethods