code: private void paintSortElement(final WDataTable table, final XmlStringBuilder xml) {
  		int col = table.getSortColumnIndex();
  		boolean ascending = table.isSortAscending();
  
  		xml.appendTagOpen("ui:sort");
  		xml.appendOptionalAttribute("col", col >= 0, col);
  		xml.appendOptionalAttribute("descending", col >= 0 && !ascending, "true");
  
  		switch (table.getSortMode()) {
  			case SERVER:
  			case DYNAMIC:
  				xml.appendAttribute("mode", "dynamic");
  				break;
  			default:
  				throw new SystemException("Unknown sort mode: " + table.getSortMode());
  		}
  
  		xml.appendEnd();
  	}
docs: Paint the rowSelection aspects of the WDataTable.
  @param table the WDataTable being rendered
  @param xml the string builder in use