The admin generator for Symfony 1.4.x integrated with the DataTables jQuery plugin.
It allows to avoid reloading the page every time you go to next/previous page, managing data display through one of the best plugins to load and show table data: DataTables.
The package file contains three folders, following the tree structure of a default Symfony 1.4.x installation.
The folders are:
apps/ contains a couple of examples on how you are able to customize my package. There are two modules: state and city, which are those of the demo page.
It contains the admin generator to be installed to your Symfony project.
When using this admin generator theme, the raw list provided by Symfony library is changed into a table powered by the DataTables plugin.
Follow this procedure to install the package:
You will find 3 folders in it:
This guide starts from a working installation of Symfony 1.4.x. If You don't have already created your project, please refer to Symfony documentation.
Copy the content of the extracted data/ folder into the data/ folder of your Symfony project.
The name of the new admin generator is admin_iml. The installation of the admin generator is that simple, from now on you will be able to use it in any admin Symfony module of your project.
Copy the file jquery.dataTables.min.js contained in the web/js/ directory of the package in the js/ folder of your Symfony project. You can also download the latest version of this plugin from here.
As it requires jQuery to work, copy the file jquery-1.5.2.min.js contained in the web/js/ directory of the package in the js/ folder of your Symfony project if not already included.
Optionally copy the files admin_iml.css and sf_admin_overwrite.css contained in the web/css/ directory of the package in the css/ folder of your Symfony project. The first is the default css of the plugin with small modifications and the second is made by me to correct some layout errors.
Make your admin generator configuration file (generator.yml) look like this:
generator: class: sfDoctrineGenerator param: model_class: City theme: admin_iml non_verbose_templates: true with_show: false singular: City plural: cities route_prefix: city with_doctrine_route: true actions_base_class: sfActions config: actions: ~ fields: ~ list: max_per_page: 1000000 batch_actions:  filter: ~ form: ~ edit: ~ new: ~
The most important things are:
to use the new admin generator theme
to load all data at once
to prevent batch actions. You can enable batch actions, but it will work only on the records displayed at the moment, and not on the entire collection of data.
Don't forget to clean the cache every time you will made changes to the admin generator, and also right now after the first installation. php symfony cc
By default the plugin is initialized in this way:
Of course you can completely customize the plugin behavior, and moreover you can make it without modifying the admin generator.
Create a file called _list_header.php in the template/ directory of your module. You can give a look to the apps/frontend/module/ folder of the package for a couple of examples.
This is a sample of the function extend_dataTable(oTable):