$this->columnBuilder
->add('fruitcolor.color', 'column', array(
'title' => 'Fruchtfarbe',
'filter' => array('select2', array(
//'select_options' => array('' => 'Alle') + $this->getCollectionAsOptionsArray($fruitcolor, 'color', 'color'),
'search_type' => 'eq',
'multiple' => true,
'placeholder' => null,
'allow_clear' => true,
'tags' => true,
'language' => 'de',
'url' => 'select2_color',
'delay' => 250,
'cache' => true
)),
))
;
/**
* @param Request $request
*
* @Route("/ajax/select2-color", name="select2_color")
*
* @return JsonResponse|Response
*/
public function select2Color(Request $request)
{
if ($request->isXmlHttpRequest()) {
$em = $this->getDoctrine()->getManager();
$colors = $em->getRepository('AppBundle:Fruitcolor')->findAll();
$result = array();
/** @var \AppBundle\Entity\Fruitcolor $color */
foreach ($colors as $color) {
$result[$color->getId()] = $color->getColor();
}
return new JsonResponse($result);
}
return new Response('Bad request.', 400);
}
$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
));
- Include the jQuery Highlight Plugin
- Configure your Datatables-Class features
$this->features->set(array(
// ...
'highlight' => true,
'highlight_color' => 'red' // 'red' is the default value
));
see #401
The Bootstrap modal window does not work properly in responsive mode.
Load Featherlight with your base layout.
$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(
// ...
)
));
before
'actions' => array(
array(
'route' => 'post_edit',
'route_parameters' => array(
'id' => 'id'
),
'role' => 'ROLE_ADMIN',
'render_if' => function($row) {
return ($row['title'] === 'Title 1');
},
),
// ...
after
'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);
},
))
;
Extensions like Buttons or Responsive
Integrate the Translatable behavior extension for Doctrine 2
Integrate the LiipImagineBundle / ImageColumn, GalleryColumn and thumbnails
Much like every other piece of software SgDatatablesBundle
is not perfect and far from feature complete.
- This bundle does not support multiple Ids.
- Searching and filtering on a virtual column not yet implemented and disabled by default.
- PostgreSql is currently not fully supported.
Issues and feature requests are tracked in the Github issue tracker.
You must know that all the pull requests you are going to submit must be released under the MIT license.
This bundle is under the MIT license. See the complete license in the bundle:
Resources/meta/LICENSE
You are free to use, modify and distribute this software, as long as the copyright header is left intact (specifically the comment block which starts with /*)!