You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 17, 2019. It is now read-only.
CollectionEngine currently does not support ordering by multiple columns.
I tried extending the Collection class inside Datatable, and adding a new function (sortByMulti), but never got too far into adding this functionality.
publicfunctionsortByMutli($callback, $fields, $options = SORT_REGULAR, $descending = false)
{
$required_keys = array_keys($fields);
$items = [];
// First we will loop through the items and get the comparator from a callback// function which we were given. Then, we will sort the returned values and// and grab the corresponding values for the sorted keys from this array.foreach ($this->itemsas$key => $value) {
print_r($key);
$results[$key] = $callback($value, $key);
foreach($required_keysas$_key) {
print_r($this->items);
if (!isset($items[$_key]))
$items[$_key] = [];
$items[$_key][$key] = $results[$key][$_key];
}
}
// Then we need to go through and finally sort all the items by the// requested direction.$column_sort = ['$results'];
foreach($fieldsas$key => $item) {
print_r($key);
$column_sort[] = "\$$key";
$column_sort[] = $this->sortByOrder($direction);
}
call_user_func_array('array_multisort', $column_sort);
}
CollectionEngine currently does not support ordering by multiple columns.
I tried extending the
Collectionclass inside Datatable, and adding a new function (sortByMulti), but never got too far into adding this functionality.