Skip to content

Commit

Permalink
changed sorting to be case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-k committed Apr 30, 2019
1 parent 0ae2c1a commit e2f74aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ will return the next `20` entries that are located on `page 2`.


### `sort`
In order to sort the results using different parameters, you can simply concatenate them using `,`. In order to provide `ASC` and `DESC` sorting, you may prepend a `-` before respective attribute.
In order to sort the results using different parameters, you can simply concatenate them using `,`. In order to provide `ASC` and `DESC` sorting, you may prepend a `-` before respective attribute. Sorting is case-insensitive.

For example
```php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ private function callbackSearchable($criteria)
foreach ($criteria as $c) {
// normalize sort direction
$orderType = strtolower($c['direction']);
if ($first[$c['column']] < $second[$c['column']]) {
if (strtolower($first[$c['column']]) < strtolower($second[$c['column']])) {
return $orderType === "asc" ? -1 : 1;
} elseif ($first[$c['column']] > $second[$c['column']]) {
} elseif (strtolower($first[$c['column']]) > strtolower($second[$c['column']])) {
return $orderType === "asc" ? 1 : -1;
}
}
Expand Down

0 comments on commit e2f74aa

Please sign in to comment.