PHP code example of edweld / datatablesbundle
1. Go to this page and download the library: Download edweld/datatablesbundle library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
edweld / datatablesbundle example snippets
$this->columnBuilder
->add('name', 'column', array(
'title' => 'Name',
'editable' => true,
'editable_if' => function($row) {
return (
$this->authorizationChecker->isGranted('ROLE_USER') &&
$row['public'] == true
);
}
))
$this->ajax->set(array(
'url' => $this->router->generate('chili_private_results'),
'pipeline' => 6
));
$this->features->set(array(
// ...
'highlight' => true,
'highlight_color' => 'red' // 'red' is the default value
));
$this->columnBuilder
->add('title', 'column', array(
// ...
'add_if' => function() {
return ($this->authorizationChecker->isGranted('ROLE_ADMIN'));
},
))
;
$this->topActions->set(array(
// ...
'add_if' => function() {
return ($this->authorizationChecker->isGranted('ROLE_ADMIN'));
},
'actions' => array(
// ...
)
));
'actions' => array(
array(
'route' => 'post_edit',
'route_parameters' => array(
'id' => 'id'
),
'role' => 'ROLE_ADMIN',
'render_if' => function($row) {
return ($row['title'] === 'Title 1');
},
),
// ...
'actions' => array(
array(
'route' => 'post_edit',
'route_parameters' => array(
'id' => 'id'
),
'render_if' => function($row) {
return (
$this->authorizationChecker->isGranted('ROLE_USER') &&
$row['user']['username'] == $this->getUser()->getUsername()
);
},
),
// ...
$this->columnBuilder
->add('title', 'multiselect', array(
// ...
'render_checkbox_if' => function($row) {
return ($row['public'] == true);
},
))
;