1
- Table of contents
2
-
3
- - [ Actions] ( #actions )
4
- - [ Api] ( #api )
5
- - [ Parameters] ( #parameters )
6
- - [ Icon] ( #icon )
7
- - [ Class] ( #class )
8
- - [ Title] ( #title )
9
- - [ Confirmation] ( #confirmation )
10
- - [ Ajax] ( #ajax )
11
- - [ Redrawing the data] ( #redrawing-the-data )
12
- - [ Redrawing one row] ( #redrawing-one-row )
13
- - [ Sortable] ( #sortable )
14
- - [ Sorting handler] ( #sorting-handler )
15
- - [ MultiAction] ( #multiaction )
16
- - [ Item detail] ( #item-detail )
17
- - [ Item detail form] ( #item-detail-form )
18
- - [ Item detail template variables] ( #item-detail-template-variables )
19
- - [ Item detail render condition] ( #item-detail-render-condition )
20
- - [ ActionCallback] ( #actioncallback )
21
- - [ Toolbar button] ( #toolbar-button )
22
-
23
1
# Actions
24
2
25
- ## Api
26
-
27
- ### Parameters
3
+ - [ Api] ( #api )
4
+ - [ Parameters] ( #parameters )
5
+ - [ Icon] ( #icon )
6
+ - [ Class] ( #class )
7
+ - [ Title] ( #title )
8
+ - [ Confirmation] ( #confirmation )
9
+ - [ Ajax] ( #ajax )
10
+ - [ Redrawing the data] ( #redrawing-the-data )
11
+ - [ Redrawing one row] ( #redrawing-one-row )
12
+ - [ Sortable] ( #sortable )
13
+ - [ Sorting handler] ( #sorting-handler )
14
+ - [ MultiAction] ( #multiaction )
15
+ - [ Item detail] ( #item-detail )
16
+ - [ Item detail form] ( #item-detail-form )
17
+ - [ Item detail template variables] ( #item-detail-template-variables )
18
+ - [ Item detail render condition] ( #item-detail-render-condition )
19
+ - [ ActionCallback] ( #actioncallback )
20
+ - [ Toolbar button] ( #toolbar-button )
21
+
22
+ -----
23
+
24
+ # Api
25
+
26
+ ## Parameters
28
27
29
28
Parameters are the same as in ColumnLink:
30
29
@@ -35,7 +34,7 @@ Parameters are the same as in ColumnLink:
35
34
$grid->addAction('edit', 'Edit');
36
35
```
37
36
38
- ### Icon
37
+ ## Icon
39
38
40
39
``` php
41
40
$grid->addAction('edit', '')
@@ -45,7 +44,7 @@ $grid->addAction('send', '')
45
44
->setIcon(function($item) { return $item->sent_already ? 'repeat' : 'envelope'; });
46
45
```
47
46
48
- ### Class
47
+ ## Class
49
48
50
49
``` php
51
50
$grid->addAction('dosth', '', 'doSomething!')
@@ -61,7 +60,7 @@ $grid->addAction('send', '')
61
60
->setClass(function($item) { return $item->sent_already ? 'btn btn-xs btn-success' : 'btn btn-xs btn-default' });
62
61
```
63
62
64
- ### Title
63
+ ## Title
65
64
66
65
``` php
67
66
$grid->addAction('edit', '')
@@ -71,7 +70,7 @@ $grid->addAction('edit', '')
71
70
72
71
Action title can be defined by custom callback same as title or class.
73
72
74
- ### Confirmation
73
+ ## Confirmation
75
74
76
75
``` php
77
76
$grid->addAction('delete', '', 'delete!')
@@ -96,9 +95,9 @@ $grid->addAction('delete', '', 'delete!')
96
95
);
97
96
```
98
97
99
- ## Ajax
98
+ # Ajax
100
99
101
- ### Redrawing the data
100
+ ## Redrawing the data
102
101
103
102
All links are by default not-ajax. Do you see the bold ` ajax ` class in previous example? The ajax handler could now look like this:
104
103
@@ -120,7 +119,7 @@ public function handleDelete($id)
120
119
}
121
120
```
122
121
123
- ### Redrawing one row
122
+ ## Redrawing one row
124
123
125
124
When you are updating row data (i.e. status), you can send only one row as snippet, not the whole table:
126
125
@@ -142,7 +141,7 @@ public function handleSetStatus($id, $status)
142
141
143
142
```
144
143
145
- ## Sortable
144
+ # Sortable
146
145
147
146
You can tell datagrid to be sortable (drag & ; drop):
148
147
@@ -234,7 +233,7 @@ public function handleSort($item_id, $prev_id, $next_id)
234
233
}
235
234
```
236
235
237
- ### Sorting handler
236
+ ## Sorting handler
238
237
239
238
The name of the handler used for sorting can be changed:
240
239
@@ -248,7 +247,7 @@ Also, when you are using datagrid in component, you have to alter the name a bit
248
247
$grid->setSortableHandler('myComponent:sort!');
249
248
```
250
249
251
- ## MultiAction
250
+ # MultiAction
252
251
253
252
Same as there is column status with pretty dropdown menu, the datagrid comes with similar dropdown menu for actions. It is called MultiAction:
254
253
@@ -268,7 +267,7 @@ $grid->getAction('multi_blah')
268
267
->getAction('blah2')->setIcon('check');
269
268
```
270
269
271
- ## Item detail
270
+ # Item detail
272
271
273
272
As you can see in the demo page, there is a little eye button that toggles an item detail. This detail is loaded via ajax (just for the first time). The detail can be rendered in separate template or via custom renderer or in block ` #detail ` , which you define in you datagrid template. First, you need to enable the items detail functionality:
274
273
@@ -289,7 +288,7 @@ $grid->setItemsDetail(__DIR__ . '/templates/Datagrid/grid_item_detail.latte');
289
288
$grid->setItemsDetail(function() { return 'Lorem Ipsum'; });
290
289
```
291
290
292
- ### Item detail form
291
+ ## Item detail form
293
292
294
293
User may use a ItemDetail containing a form (` ItemDetailForm ` ). Example usage:
295
294
@@ -332,11 +331,11 @@ Datagrid user template:
332
331
333
332
```
334
333
335
- ### Item detail template variables
334
+ ## Item detail template variables
336
335
337
336
Additional variables can be passed to item detail template (/block) via ` ItemDetail::setTemplateParameters(['foo' => 'bar', ...]) `
338
337
339
- ### Item detail render condition
338
+ ## Item detail render condition
340
339
341
340
Custom callback can be set to decide whether to render item detail or not:
342
341
@@ -346,7 +345,7 @@ $grid->getItemsDetail()->setRenderCondition(function($item) {
346
345
});
347
346
```
348
347
349
- ## ActionCallback
348
+ # ActionCallback
350
349
351
350
You don't have to fire event only using ` PresenterComponent ` signals. There is a possibility to fire events directly:
352
351
@@ -363,7 +362,7 @@ $grid->addActionCallback('custom_callback', '')
363
362
364
363
You treat ` ActionCallback ` same as ` Action ` , except for some arguments passed to the ` Datagrid::addActionCallback ` method.
365
364
366
- ## Toolbar button
365
+ # Toolbar button
367
366
368
367
If you need simple links to custom destinations from datagrid toolbar, they can be added like this:
369
368
0 commit comments