Download the PHP package waldo/datatable-bundle without Composer

On this page you can find all versions of the php package waldo/datatable-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package datatable-bundle

DatatableBundle

Fork of AliHichem/DatatableBundle, this bundle will add some great features and evolve in a different way than it source.

Build Status SensioLabsInsight

Warning: The jQuery Datatable plugin has evolved (version 1.10) with a all new API and option.
You MUST use the version 2 of DatatableBundle with the jQuery Datatable plugin version lower than 1.10.
You MUST use the version 3 of DatatableBundle with the jQuery Datatable plugin version equal or greater than 1.10.

The Datatable bundle for symfony2 allow for easily integration of the jQuery Datatable plugin with the doctrine2 entities. This bundle provides a way to make a projection of a doctrine2 entity to a powerful jquery datagrid. It mainly includes:


Summary


Installation

Installation is a quick (I promise!) 3 step process:

  1. Download DatatableBundle using Composer
  2. Enable the Bundle
  3. Configure the Bundle

Download DatatableBundle using Composer

Using Composer

Install with this command : composer require waldo/datatable-bundle

Generate the assets symlinks :

Enable the Bundle

Add the bundle to the AppKernel.php

Configure the Bundle

In this section you can put the global config that you want to set for all the instance of DataTable in your project.

To keep it to default

The js config will be applied to DataTable exactly like you do with $().datatable({ your config }); in a javascript part.

Note: all your js config have to be string typed, make sure to use (") as delimiters.

Config sample

How to use DatatableBundle ?

Assuming for example that you need a grid in your "index" action, create in your controller method as below :

Warning alias as is case-sensitive, always write it in lower case

Rendering inside Twig

You have the choice, you can render the HTML table part and Javascript part in just one time with the Twig function datatable, like below.

Or, render each part separatly.

datatable_html is the Twig function for the HTML part.
datatable_js is the Twig function for the Javascript part.

Advanced Use of DatatableBundle

Advanced php config

Assuming the example above, you can add your joins and where statements.

Use of search filter

Activate search globally

The searching functionality that is very useful for quickly search through the information from the database. This bundle provide two way of searching, who can be used together : global search and individual column search.

By default the filtering functionality is disabled, to get it working you just need to activate it from your configuration method like this :

Set search fields

You can set fields where you want to enable your search. Let say you want search to be active only for "field 1" and "field3 ", you just need to activate search for the approriate column key and your datatable config should be :

Multiple actions, how to had checkbox for each row ?

Sometimes, it's good to be able to do the same action on multiple records like deleting, activating, moving ... Well this is very easy to add to your datatable: all what you need is to declare your multiple action as follow.

Then all what you have to do is to add the necessary logic in your "multiple_delete_route" (or whatever your route is for). In that action, you can get the selected ids by :

Custom renderer for cells

Twig renderers

To set your own column structure, you can use a custom twig renderer as below : In this example you can find how to set the use of the default twig renderer for action fields which you can override as your own needs.

In a twig renderer you can have access the the field value using dt_item variable,

or access the entire entity object using dt_obj variable.

NOTE: be careful of Doctrine's LAZY LOADING when using dt_obj !

PHP Closures

Assuming the example above, you can set your custom fields renderer using PHP Closures.

DataTable Callbacks options

If you need to put some Javascript Callbacks like drawCallback, you can do it localy with the Datatable js option. See the two examples below:

You can also define a Callback globally by setting it up in the config.yml like below :

Translation

You can set your own translated labels by adding in your translation catalog entries as define in Resources/translations/messages.en.yml

You can also get the translated labels from official DataTable translation repository, by configuring the bundle like below :

This bundle includes nine translation catalogs: Arabic, Chinese, Dutch, English, Spanish, French, Italian, Polish, Russian and Turkish To get more translated entries, you can follow the official DataTable translation

Doctrine Query Builder

To use your own query object to supply to the datatable object, you can perform this action using your own "Doctrine Query object": DatatableBundle allow to manipulate the query object provider which is now a Doctrine Query Builder object, you can use it to update the query in all its components except of course in the selected field part.

This is a classic config before using the Doctrine Query Builder:

This is a config that uses a Doctrine Query object a query builder :

Multiple DataTable in the same view

To declare multiple DataTables in the same view, you have to set the datatable identifier in you controller with setDatatableId : Each of your DataTable config methods ( datatable() , datatable_1() .. datatable_n() ) needs to set the same identifier used in your view:

In the controller

In the view

Use specific jQuery DataTable options

Some time we need to apply some specific options to a grid, like a specific width for the second column. DataTable comes with a lot a feature that you can always use, even with this bundle.

In the code below, we use the columnDefs option to fix the width of the second column.

You really can play with all the DataTable's options.


All versions of datatable-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
twig/twig Version ~1.8
doctrine/common Version ~2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package waldo/datatable-bundle contains the following files

Loading the files please wait ....