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-
231# Actions
242
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
2827
2928Parameters are the same as in ColumnLink:
3029
@@ -35,7 +34,7 @@ Parameters are the same as in ColumnLink:
3534$grid->addAction('edit', 'Edit');
3635```
3736
38- ### Icon
37+ ## Icon
3938
4039``` php
4140$grid->addAction('edit', '')
@@ -45,7 +44,7 @@ $grid->addAction('send', '')
4544 ->setIcon(function($item) { return $item->sent_already ? 'repeat' : 'envelope'; });
4645```
4746
48- ### Class
47+ ## Class
4948
5049``` php
5150$grid->addAction('dosth', '', 'doSomething!')
@@ -61,7 +60,7 @@ $grid->addAction('send', '')
6160 ->setClass(function($item) { return $item->sent_already ? 'btn btn-xs btn-success' : 'btn btn-xs btn-default' });
6261```
6362
64- ### Title
63+ ## Title
6564
6665``` php
6766$grid->addAction('edit', '')
@@ -71,7 +70,7 @@ $grid->addAction('edit', '')
7170
7271Action title can be defined by custom callback same as title or class.
7372
74- ### Confirmation
73+ ## Confirmation
7574
7675``` php
7776$grid->addAction('delete', '', 'delete!')
@@ -96,9 +95,9 @@ $grid->addAction('delete', '', 'delete!')
9695 );
9796```
9897
99- ## Ajax
98+ # Ajax
10099
101- ### Redrawing the data
100+ ## Redrawing the data
102101
103102All links are by default not-ajax. Do you see the bold ` ajax ` class in previous example? The ajax handler could now look like this:
104103
@@ -120,7 +119,7 @@ public function handleDelete($id)
120119}
121120```
122121
123- ### Redrawing one row
122+ ## Redrawing one row
124123
125124When you are updating row data (i.e. status), you can send only one row as snippet, not the whole table:
126125
@@ -142,7 +141,7 @@ public function handleSetStatus($id, $status)
142141
143142```
144143
145- ## Sortable
144+ # Sortable
146145
147146You can tell datagrid to be sortable (drag & ; drop):
148147
@@ -234,7 +233,7 @@ public function handleSort($item_id, $prev_id, $next_id)
234233}
235234```
236235
237- ### Sorting handler
236+ ## Sorting handler
238237
239238The name of the handler used for sorting can be changed:
240239
@@ -248,7 +247,7 @@ Also, when you are using datagrid in component, you have to alter the name a bit
248247$grid->setSortableHandler('myComponent:sort!');
249248```
250249
251- ## MultiAction
250+ # MultiAction
252251
253252Same as there is column status with pretty dropdown menu, the datagrid comes with similar dropdown menu for actions. It is called MultiAction:
254253
@@ -268,7 +267,7 @@ $grid->getAction('multi_blah')
268267 ->getAction('blah2')->setIcon('check');
269268```
270269
271- ## Item detail
270+ # Item detail
272271
273272As 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:
274273
@@ -289,7 +288,7 @@ $grid->setItemsDetail(__DIR__ . '/templates/Datagrid/grid_item_detail.latte');
289288$grid->setItemsDetail(function() { return 'Lorem Ipsum'; });
290289```
291290
292- ### Item detail form
291+ ## Item detail form
293292
294293User may use a ItemDetail containing a form (` ItemDetailForm ` ). Example usage:
295294
@@ -332,11 +331,11 @@ Datagrid user template:
332331
333332```
334333
335- ### Item detail template variables
334+ ## Item detail template variables
336335
337336Additional variables can be passed to item detail template (/block) via ` ItemDetail::setTemplateParameters(['foo' => 'bar', ...]) `
338337
339- ### Item detail render condition
338+ ## Item detail render condition
340339
341340Custom callback can be set to decide whether to render item detail or not:
342341
@@ -346,7 +345,7 @@ $grid->getItemsDetail()->setRenderCondition(function($item) {
346345});
347346```
348347
349- ## ActionCallback
348+ # ActionCallback
350349
351350You don't have to fire event only using ` PresenterComponent ` signals. There is a possibility to fire events directly:
352351
@@ -363,7 +362,7 @@ $grid->addActionCallback('custom_callback', '')
363362
364363You treat ` ActionCallback ` same as ` Action ` , except for some arguments passed to the ` Datagrid::addActionCallback ` method.
365364
366- ## Toolbar button
365+ # Toolbar button
367366
368367If you need simple links to custom destinations from datagrid toolbar, they can be added like this:
369368
0 commit comments