private void sort(List<SortField2> sortFields) {
if (sortFields != null && !sortFields.isEmpty()) {
FacesContext context = FacesContext.getCurrentInstance();
ObjectWrapperFactory wrapperFactory = new RowKeyWrapperFactory(
context, var, sortFields);
WrappedBeanComparator2 wrappedBeanComparator = new WrappedBeanComparator2(
sortFields);
wrapperFactory.wrapList(rowKeys);
Collections.sort(rowKeys, wrappedBeanComparator);
wrapperFactory.unwrapList(rowKeys);
}