File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
4
4
5
5
## [ Unreleased]
6
6
7
+ ### Added
8
+
9
+ - Added option for single column sorting only
10
+
7
11
## [ 1.3.1] - 2021-04-26
8
12
9
13
### Added
Original file line number Diff line number Diff line change 10
10
trait WithSorting
11
11
{
12
12
public bool $ showSorting = true ;
13
+ public bool $ singleColumnSorting = false ;
13
14
public array $ sorts = [];
14
15
public array $ sortNames = [];
15
16
public array $ sortDirectionNames = [];
16
17
17
18
public function sortBy (string $ field ): ?string
18
19
{
20
+ if ($ this ->singleColumnSorting && count ($ this ->sorts ) && !isset ($ this ->sorts [$ field ])) {
21
+ $ this ->sorts = [];
22
+ }
23
+
19
24
if (! isset ($ this ->sorts [$ field ])) {
20
25
return $ this ->sorts [$ field ] = 'asc ' ;
21
26
}
You can’t perform that action at this time.
0 commit comments