ColumnsSort Process
Sort columns by name or label
name | income |
John |
50,000 |
Marry |
60,000 |
Peter |
100,000 |
Donald |
80,000 |
->pipe(new ColumnsSort(array(
"{name}" => "asc",
// "{label}" => "desc",
// "{name}" => function ($a, $b) { return $a < $b ? -1 : 1; },
// "{label}" => function ($a, $b) { return $a < $b ? 1 : -1; },
)))
income | name |
50,000 |
John |
60,000 |
Marry |
100,000 |
Peter |
80,000 |
Donald |
ColumnsSort is a process to sort your data pipe's columns by their names or labels. The sort direct could be ascending, descending, or custom comparative function order.
__Sample code__
```
->pipe(new ColumnsSort(array(
"{name}" => "asc",
// "{label}" => "desc",
// "{name}" => function ($a, $b) { return $a < $b ? -1 : 1; },
// "{label}" => function ($a, $b) { return $a < $b ? 1 : -1; },
)))
```