Home
1 site, unlimited servers No source distribution Commercial use allowed Can modify source Read full license | More Info
Price: $ 7.99
This package integrates the Symfony 1.4.x Admin generator with a javascript plugin to display large lists of data without using the raw pagination given by default.
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.
By defining the javascript function extend_dataTable() you are able to completely customize the DataTables plugin.
It contains the admin generator to be installed to your Symfony project.
It contains come css and the javascript files to be included.
When using this admin generator theme, the raw list provided by Symfony library is changed into a table powered by the DataTables plugin.
More deeply, in the file /data/generator/sfDoctrineModule/admin_iml/template/_list.php is contained the javascript function to initialize the table representing your data to display, converting it into a smart javascript table with quick and non-reloading pagination.
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:
theme: admin_iml
to use the new admin generator theme
max_per_page: 1000000
to load all data at once
batch_actions: []
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.
The only thing you have to do is define a javascript function called
extend_dataTable(oTable)
and put all your customizations into it. In the function you have at your disposal the variable oTable, which is the javascript object created when the plugin was called. Just look at the plugin documentation, you don't need nothing else!
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):
You're done!
Price: $ 7.99
Questions & Comments
Leave a comment
Log-in now or register for a free account.