|
7 | 7 |
|
8 | 8 | ## Configuration |
9 | 9 |
|
10 | | -## client side |
| 10 | +## 1- client side |
11 | 11 |
|
12 | 12 |
|
13 | | -**props datatable components** |
| 13 | +### props datatable components |
14 | 14 |
|
15 | | -**config** |
| 15 | +#### config |
16 | 16 | ```html |
17 | 17 | // resources/posts/index.blade.php |
18 | 18 |
|
19 | | -<x-app-layout> |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | 19 | <data-table |
25 | | - |
26 | 20 | :config="{ |
27 | | - url: `/admin/places/all?page=1`, |
28 | | -
|
| 21 | + url: `/posts/all?page=1`, |
29 | 22 | toolbar:{ |
30 | 23 | show: true, |
31 | 24 | delete: { |
32 | | - url: `/${this.lang}/admin/places/destroy/all` |
| 25 | + url: `posts/destroy/all` |
| 26 | + show: `true` |
33 | 27 | } |
34 | 28 | }, |
35 | | - perPage: { |
36 | | - show: true, |
37 | | - counts: [5,10, 25, 50, 100, 250], |
38 | | - }, |
39 | | - filter:{ |
40 | | - selection:{ |
41 | | - show: true, |
42 | | - data:[ |
43 | | - { |
44 | | - label: 'Admins', |
45 | | - relation: 'createdBy', |
46 | | - column: 'first_name', |
47 | | - rows: {{json_encode($admins)}} |
48 | | - |
49 | | - }, |
50 | | - ] |
51 | | - } |
52 | | - } |
53 | 29 | |
54 | | - }" |
55 | | - |
| 30 | + }" |
| 31 | + ></data-table> |
| 32 | + |
| 33 | +``` |
56 | 34 |
|
| 35 | +| Name | Type | Default | Description |
| 36 | +| --- | --- | --- | --- | |
| 37 | +| `url ` | String | "/" | (required) json data url | |
| 38 | +| `toolbar` | Object | {} | to setup toolbar | |
| 39 | +| `toolbar.show` | Bool | true | to disable or enable toolbar | |
| 40 | +| `toolbar.delete` | Object | {} | to add delete all option to toolbar | |
| 41 | +| `toolbar.delete.url` | String | '/' | to set delete all url | |
| 42 | +| `toolbar.delete.show` | Bool | true | to disable or enable delete button | |
| 43 | +| `search` | Object | {} | to setup search input | |
| 44 | +| `search.show` | Bool | true | disable or enable the feature | |
| 45 | + |
| 46 | + |
| 47 | +#### perPage |
| 48 | +```html |
| 49 | +// resources/posts/index.blade.php |
| 50 | + |
| 51 | + <data-table |
| 52 | + :perPage="{ |
| 53 | + show: true, |
| 54 | + counts: [5,10, 25, 50, 100, 250], |
| 55 | + }" |
57 | 56 | ></data-table> |
58 | 57 |
|
| 58 | +``` |
| 59 | + |
| 60 | +| Name | Type | Default | Description |
| 61 | +| --- | --- | --- | --- | |
| 62 | +| `perPage` | Object | {} | to add rows count per page | |
| 63 | +| `perPage.show` | Bool | true | disable or enable the feature | |
| 64 | +| `perPage.count` | Array | [10, 25, 50, 100, 250] | to add rows counts you want to appear on a page | |
| 65 | + |
59 | 66 |
|
60 | 67 |
|
| 68 | +#### filters |
| 69 | +```html |
| 70 | +// resources/posts/index.blade.php |
61 | 71 |
|
| 72 | + <data-table |
| 73 | + :filters="{ |
| 74 | + selection:{ |
| 75 | + show: true, |
| 76 | + data:[ |
| 77 | + { |
| 78 | + label: 'Admins', |
| 79 | + relation: 'createdBy', |
| 80 | + column: 'first_name', |
| 81 | + rows: {{json_encode($admins)}} |
| 82 | + |
| 83 | + }, |
| 84 | + ] |
| 85 | + } |
| 86 | + }" |
| 87 | + ></data-table> |
62 | 88 |
|
63 | | -</x-app-layout> |
64 | | -} |
65 | 89 | ``` |
66 | 90 | | |
67 | 91 |
|
68 | 92 | | Name | Type | Default | Description |
69 | 93 | | --- | --- | --- | --- | |
70 | | -| `url ` | String | "/" | json data url | |
71 | | -| `toolbar` | Object | {} | to add toolbar config | |
72 | | -| `toolbar.show` | Object | {} | to disable or enable toolbar | |
73 | | -| `toolbar.delete` | Object | {} | to add toolbar config | |
74 | | -| `toolbar.delete.url` | Object | {} | to add toolbar config | |
75 | | -| `perPage` | Object | {} | to add page rows count config | |
76 | | -| `perPage.show` | Object | {} | disable or enable the feature | |
77 | | -| `perPage.count` | Object | {} | to add rows counts you want to appear on a page | |
78 | 94 | | `filter` | Object | {} | Add filters data | |
79 | 95 | | `filter.selection` | Object | {} | the object contains all filter selection data | |
80 | | -| `filter.selection.show` | Object | {} | to disable or enable selection filter | |
| 96 | +| `filter.selection.show` | Bool | true | to disable or enable selection filter | |
81 | 97 | | `filter.selection.data` | Object | {} | the object is array contains all select input options | |
82 | | -| `filter.selection.data.label` | Object | {} | name appears beside select input | |
83 | | -| `filter.selection.data.relation` | Object | {} | relation name you will get it | |
84 | | -| `filter.selection.data.column` | Object | {} | column you will get it | |
85 | | -| `filter.selection.data.rows` | Object | {} | all rows from the database as JSON | |
| 98 | +| `filter.selection.data.label` | String | '' | name appears beside select input | |
| 99 | +| `filter.selection.data.relation` | String | '' | relation name you will get it | |
| 100 | +| `filter.selection.data.column` | String | '' | column name you will get it | |
| 101 | +| `filter.selection.data.rows` | Json | [{}] | all rows from the database as JSON | |
| 102 | + |
| 103 | + |
86 | 104 |
|
87 | 105 | **columns** |
88 | 106 | ```html |
89 | 107 | // resources/posts/index.blade.php |
90 | 108 |
|
91 | | -<x-app-layout> |
92 | | - |
93 | | - |
94 | | - |
95 | | - |
96 | 109 | <data-table |
97 | | - |
98 | 110 | :columns="[ |
99 | | - |
100 | 111 | { |
101 | 112 | label: 'Title', |
102 | 113 | column: 'title', |
|
110 | 121 | |
111 | 122 | ] |
112 | 123 | " |
113 | | - |
114 | | - |
115 | 124 | ></data-table> |
116 | | - |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | -</x-app-layout> |
122 | | -} |
123 | 125 | ``` |
124 | 126 | | |
125 | 127 |
|
|
129 | 131 | | `column` | String | '' | database column name | |
130 | 132 | | `show` | Bool | true | to add toolbar config | |
131 | 133 | | `sort` | Object | {} | is responsible for sort column | |
132 | | -| `sort.sortable` | Bool | true | if you want to use column for sorting | |
| 134 | +| `sort.sortable` | Bool | true | disable or enable sorting | |
133 | 135 | | `sort.sortColumn` | String | '' | column name for sorting | |
134 | 136 | | `sort.sortDir` | String | asc | sort direction for first sorting | |
0 commit comments