// Columns without a key path or sort path can't be sorted
if (currentSortPath() == null || ! canResort()) {
return;
}
NSMutableDictionary sortOrder = currentColumnSortOrder();
// Adding a new sort
if (sortOrder == null) {
NSMutableDictionary newSortOrder = new NSMutableDictionary(2);
newSortOrder.setObjectForKey(currentSortPath(), KEY_PATH);
newSortOrder.setObjectForKey(SORT_ASCENDING, SORT_DIRECTION);
// Keep hidden, mandatory sort as the least important
if (hasMandatorySort() &&
((NSMutableDictionary) sortOrdersByKeypath().objectForKey(manadatorySortKeyPath())).valueForKey(MANDATORY_SORT_ORDER_FLAG) != null) {
sortOrders().insertObjectAtIndex(newSortOrder, sortOrders().count() - 1);