In order to customize built-in sorting you just need:

- Turn selfSorted on the columns to "false"
- Bind sortOrder attributes on the columns to the bean properties.
- Manage the bindings with values from org.richfaces.model.Ordering enum.
- If the sorting is multiple - fill the sortPriorities list with column ids in the order the columns should be sorted.

Try next example. Just change sorting order on the table through attributes and it automatically resort its content. In order to perform sorting just choose the sorting properties, sorting direction and press sort button:

Sorting DataTable example