Skip to content

This Bundle integrates the jQuery DataTables plugin into your Symfony application.

Notifications You must be signed in to change notification settings

LaurentFl/DatatablesBundle

 
 

Repository files navigation

SgDatatablesBundle

SensioLabsInsight

knpbundles.com

Latest Stable Version Total Downloads Latest Unstable Version License

1. Recent Changes

In-place editing

In-place editing for text, datetime and boolean fields added (before usage you should manually include dependent x-editable js and css files).

Example:

->add('title', 'column', array(
    'title' => 'Titel',
    'editable' => true
))
->add('publishedAt', 'datetime', array(
    'title' => 'PublishedAt',
    'name' => 'daterange',
    'date_format' => 'll',
    'editable' => true
))
->add('visible', 'boolean', array(
    'title' => 'Visible',
    'editable' => true
))
Screenshot

Token for multiselect actions

The multiselect ajax request sends now a CSRF-Token.

Update your bulk-actions like this:

/**
 * Bulk delete action.
 *
 * @param Request $request
 *
 * @Route("/bulk/delete", name="post_bulk_delete")
 * @Method("POST")
 *
 * @return Response
 */
public function bulkDeleteAction(Request $request)
{
    $isAjax = $request->isXmlHttpRequest();

    if ($isAjax) {
        $choices = $request->request->get('data');
        $token = $request->request->get('token');

        if (!$this->isCsrfTokenValid('multiselect', $token)) {
            throw new AccessDeniedException('The CSRF token is invalid.');
        }

        $em = $this->getDoctrine()->getManager();
        $repository = $em->getRepository('AppBundle:Post');

        foreach ($choices as $choice) {
            $entity = $repository->find($choice['value']);
            $em->remove($entity);
        }

        $em->flush();

        return new Response('Success', 200);
    }

    return new Response('Bad Request', 400);
}

2. Screenshots

Table with Bootstrap3 integration:

Screenshot

Table with default stylesheet (display):

Screenshot

3. Documentation

Installation

Column types

In-place editing

How to use the ColumnBuilder

Setup Datatable Class

Filtering

To use a line formatter

Query callbacks

Extensions like Buttons or Responsive

Options of the generator

Reference configuration

4. Example

Demo Application

5. Integrating 3rd party stuff

Integrate Bootstrap3

Integrate the Translatable behavior extension for Doctrine 2

Integrate the LiipImagineBundle / ImageColumn, GalleryColumn and thumbnails

6. Limitations and Known Issues

Much like every other piece of software SgDatatablesBundle is not perfect and far from feature complete.

Use this Bundle in ServerSide mode

The ClientSide mode currently does not work with all features. There are some problems with the Buttons-Extension and MultiSelectColumn. At the moment I can not say whether the ClientSide mode is supported by me in the future. Priority has the ServerSide mode.

Other limitations

  • This bundle does not support multiple Ids
  • 4th level associations are currently not supported
  • Searching and filtering on a virtual column not yet implemented and disabled by default
  • PostgreSql is not supported

7. Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker.

8. Friendly License

This bundle is available 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 /*)!

About

This Bundle integrates the jQuery DataTables plugin into your Symfony application.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 81.8%
  • HTML 18.2%