Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen committed Sep 3, 2016
1 parent 774c57f commit 472f758
Showing 1 changed file with 1 addition and 175 deletions.
176 changes: 1 addition & 175 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,181 +10,7 @@

## Recent Changes

### Select2 support / Multiple select filter (#287)

#### Remote example from the Docs

```php
$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
)),
))
;
```

```php
/**
* @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);
}
```

### In-place editing callback (#372)

```
$this->columnBuilder
->add('name', 'column', array(
'title' => 'Name',
'editable' => true,
'editable_if' => function($row) {
return (
$this->authorizationChecker->isGranted('ROLE_USER') &&
$row['public'] == true
);
}
))
```

### Pipelining to reduce Ajax calls

```
$this->ajax->set(array(
'url' => $this->router->generate('chili_private_results'),
'pipeline' => 6
));
```

### Search result highlighting.

**Caution: For the `highlight` feature you must set `individual_filtering_position` option to 'head'!**

1. Include the [jQuery Highlight Plugin](http://bartaz.github.io/sandbox.js/jquery.highlight.html)
2. Configure your Datatables-Class features

```
$this->features->set(array(
// ...
'highlight' => true,
'highlight_color' => 'red' // 'red' is the default value
));
```

### Enlargement of thumbnails with Featherlight

see [#401](https://github.com/stwe/DatatablesBundle/issues/401)

The Bootstrap modal window does not work properly in responsive mode.

Load [Featherlight](https://github.com/noelboss/featherlight/) with your base layout.

### `add_if` Closure for all Columns and TopActions

```
$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(
// ...
)
));
```

### Render Actions

**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()
);
},
),
// ...
```

### Multiselect: render checkboxes only if conditions are True

```
$this->columnBuilder
->add('title', 'multiselect', array(
// ...
'render_checkbox_if' => function($row) {
return ($row['public'] == true);
},
))
;
```
Nothing since v0.12.

## Screenshots

Expand Down

0 comments on commit 472f758

Please sign in to comment.