1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yajra\DataTables\Html\Options\Plugins; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* DataTables - ColReorder plugin option builder. |
7
|
|
|
* |
8
|
|
|
* @see https://datatables.net/extensions/colreorder/ |
9
|
|
|
* @see https://datatables.net/reference/option/colReorder |
10
|
|
|
* @see https://datatables.net/reference/option/#colReorder |
11
|
|
|
*/ |
12
|
|
|
trait ColReorder |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Set colReorder option value. |
16
|
|
|
* Enable and configure the AutoFill extension for DataTables. |
17
|
|
|
* |
18
|
|
|
* @param bool|array $value |
19
|
|
|
* @return $this |
20
|
|
|
* @see https://datatables.net/reference/option/colReorder |
21
|
|
|
*/ |
22
|
|
|
public function colReorder($value = true) |
23
|
|
|
{ |
24
|
|
|
$this->attributes['colReorder'] = $value; |
|
|
|
|
25
|
|
|
|
26
|
|
|
return $this; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Set colReorder enable option value. |
31
|
|
|
* |
32
|
|
|
* @param bool $value |
33
|
|
|
* @return $this |
34
|
|
|
* @see https://datatables.net/reference/option/colReorder.enable |
35
|
|
|
*/ |
36
|
|
|
public function colReorderEnable(bool $value = true) |
37
|
|
|
{ |
38
|
|
|
$this->attributes['colReorder']['enable'] = $value; |
39
|
|
|
|
40
|
|
|
return $this; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Set colReorder fixedColumnsLeft option value. |
45
|
|
|
* |
46
|
|
|
* @param int $value |
47
|
|
|
* @return $this |
48
|
|
|
* @see https://datatables.net/reference/option/colReorder.fixedColumnsLeft |
49
|
|
|
*/ |
50
|
|
|
public function colReorderFixedColumnsLeft(int $value = 0) |
51
|
|
|
{ |
52
|
|
|
$this->attributes['colReorder']['fixedColumnsLeft'] = $value; |
53
|
|
|
|
54
|
|
|
return $this; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Set colReorder fixedColumnsRight option value. |
59
|
|
|
* |
60
|
|
|
* @param int $value |
61
|
|
|
* @return $this |
62
|
|
|
* @see https://datatables.net/reference/option/colReorder.fixedColumnsRight |
63
|
|
|
*/ |
64
|
|
|
public function colReorderFixedColumnsRight(int $value = 0) |
65
|
|
|
{ |
66
|
|
|
$this->attributes['colReorder']['fixedColumnsRight'] = $value; |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Set colReorder order option value. |
73
|
|
|
* |
74
|
|
|
* @param array $value |
75
|
|
|
* @return $this |
76
|
|
|
* @see https://datatables.net/reference/option/colReorder.order |
77
|
|
|
*/ |
78
|
|
|
public function colReorderOrder(array $value = []) |
79
|
|
|
{ |
80
|
|
|
$this->attributes['colReorder']['order'] = $value; |
81
|
|
|
|
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Set colReorder realtime option value. |
87
|
|
|
* |
88
|
|
|
* @param bool $value |
89
|
|
|
* @return $this |
90
|
|
|
* @see https://datatables.net/reference/option/colReorder.realtime |
91
|
|
|
*/ |
92
|
|
|
public function colReorderRealtime(bool $value = true) |
93
|
|
|
{ |
94
|
|
|
$this->attributes['colReorder']['realtime'] = $value; |
95
|
|
|
|
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: