Skip to content

Commit 131d079

Browse files
author
Andres Campanario
committed
update README
1 parent 3128294 commit 131d079

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,31 @@ $this->Datatable->getInstance()->setConfig('csrfToken', $this->getRequest()->get
331331
```
332332
Important: if you set POST you must set "unlockedActions" on Security Component, specify the target action in the controller's initialize function
333333
```php
334-
public function initialize(): void
335-
{
336-
parent::initialize();
334+
public function initialize(): void
335+
{
336+
parent::initialize();
337337

338-
...
338+
...
339339

340-
if ($this->components()->has('Security')) {
341-
$this->Security->setConfig('unlockedActions', ['list']);
342-
}
340+
if ($this->components()->has('Security')) {
341+
$this->Security->setConfig('unlockedActions', ['list']);
342+
}
343343

344-
...
344+
...
345345

346-
}
346+
}
347347
```
348+
349+
# Add callback when row is created
350+
351+
For example, if you need to add a css class (to change row color) to each tr according to a specific value in the data
352+
353+
```php
354+
$this->Datatable->setCallbackCreatedRow(
355+
'function( row, data, dataIndex ) {
356+
if (!data.viewed) {
357+
$(row).addClass("rowhighlight");
358+
}
359+
}'
360+
);
361+
``

0 commit comments

Comments
 (0)