code: private void paintSortDetails(final WTable table, final XmlStringBuilder xml) {
  
  		int col = table.getSortColumnIndex();
  		boolean ascending = table.isSortAscending();
  
  		xml.appendTagOpen("ui:sort");
  		if (col >= 0) {
  			// Allow for column order
  			int[] cols = table.getColumnOrder();
  			if (cols != null) {
  				for (int i = 0; i < cols.length; i++) {
  					if (cols[i] == col) {
  						col = i;
  						break;
  					}
  				}
  			}
  			xml.appendAttribute("col", col);
  			xml.appendOptionalAttribute("descending", !ascending, "true");
  		}
  
  		switch (table.getSortMode()) {
  			case DYNAMIC:
  				xml.appendAttribute("mode", "dynamic");
  				break;
  			default:
  				throw new SystemException("Unknown sort mode: " + table.getSortMode());
  		}
  
  		xml.appendEnd();
  	}
docs: Paints the sort details.
  
  @param table the table being rendered
  @param xml the string builder in use