cpDataTablesPlugin - 0.1.1

A convenience plugin to include the dataTables jQuery plugin into your symfony application.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

cpDataTablesPlugin

The cpDataTablesPlugin is a symfony plugin that includes the dataTables jQuery plugin into your symfony application.

This plugin is purely a convenience plugin. The dataTables plugin, good as it is, is packaged in a rather unconventional and inconvenient manner. The cpDateTablesPlugin provides you with the latest release of dataTables ready for use.

The plugin also includes the dataTables 'extras' as well as some dataTables 'plugins'.

Installation

  • Install the plugin (via a package)

    symfony plugin:install cpDataTablesPlugin
    
  • Install the plugin (via a Subversion checkout)

    svn co http//svn.symfony-project.com/plugins/cpDataTablesPlugin/trunk plugins/cpDataTablesPlugin
    
  • Activate the plugin in the config/ProjectConfiguration.class.php

    class ProjectConfiguration extends sfProjectConfiguration
    {
      public function setup()
      {
        $this->enablePlugins(array(
          ... 
          'cpDataTablesPlugin',
          ...
        ));
      }
    }
  • Publish the plugin's assets

    php symfony plugin:publish-assets

Usage

See the dataTables web site. Queries about usage of the dataTables jQuery plugin should be directed to the original authors of that plugin.

Below are some tips specific to the use of dataTables within a symfony project.

Internationalize the table

     [php]
     $(document).ready(function() {
       $('#mytable").dataTable({
         ...
         oLanguage: { sUrl: "<?php echo '/cpDataTablesPlugin/lang/' . $sf_user->getCulture() . 'txt'; ?>" }
         ...
       });
     });

Popuplate the table via an Ajax request to the server

     [php]
     $(document).ready(function() {
       $('#mytable").dataTable({
         ...
         bServerSide: true,
         sAjaxSource: "module/action"
         ...
       });
     });