GithubHelp home page GithubHelp logo

mohamed2204 / cakephp-datatable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cnizzardini/cakephp-datatable

0.0 0.0 0.0 866 KB

CakePHP Component for interoperability between CakePHP 2.x and jQuery DataTables plugin.

Shell 0.08% JavaScript 16.85% ActionScript 0.95% PHP 7.77% CSS 6.80% HTML 67.47% ApacheConf 0.02% Batchfile 0.06%

cakephp-datatable's Introduction

CAKEPHP-DATATABLE

PLEASE NOTE: THIS IS NO LONGER UNDER ACTIVE DEVELOPMENT. THERE IS A POTENTIAL FOR ME TO PORT THE CODE TO CAKEPHP 3 IN THE DISTANT FUTURE, BUT WHO KNOWS. YOU MAY CONTINUE CREATING ISSUES AND I WILL ATTEMPT ANSWERING, BUT GENERALLY MY RESPONSE WILL INCLUDE THIS IS NO LONGER UNDER ACTIVE DEVELOPMENT. YOU ARE OF COURSE WELCOME TO FORK AND CONTINUE DEVELOPMENT FOR CAKE 2 OR BEGIN DEVELOPMENT FOR CAKE 3. THANKS! - Chris Nizzardini, 2015-10-13

Provides server-side interoperability between CakePHP 2.x and jQuery DataTables plugin.

Features

  • Takes paginated data and converts into json response compatible with datatables
  • Accepts dataTables ORDER BY requests
  • Accepts dataTables WHERE conditions
  • Accepts dataTables pagination
  • Works with LinkableBehavior and to a lesser extent Containable

Dependancies

  • PHP 5.x
  • CakePHP 2.x
  • LinkableBehavior is recommended but not required

Installation

You can either clone the project, download the project, or just copy & paste DataTableComponent.php into your projects Controller/Component directory

Demo

http://cakephpdatatables.cnizz.com/

You can setup the demo locally with the following steps:

  1. Download demo application and move it into your webroot.
  2. Configure hosts and sites-enabled in apache to point at the location of demo application and setup the local hostname (ie datatables.local)
  3. Create a database (call this datatables)
  4. Configure database.php
  5. From the shell run Console/cake schema create
  6. Import app/Config/Schema/schema.sql into your database
  7. Ensure your app/tmp directory and app/tmp sub directories are writable

The demo application is designed for CakePHP 2.3 and was built on Ubuntu 12.10 running Apache2 with PHP 5.4. It does not have the full Cake framework in it, so you'll need to have cakephp in your php include paths or create a symbolic link to cake in test.

Documentation

I'm in the process of enhancing documentation and moving it out of the README and into the wiki.

Ordering and conditions supplied via DataTables work "automagically" and nothing else is needed. Deep relations using the ContainableBehavior will break the response due to the way conditions work within that behavior. To get around this it is recommended that the LinkableBehavior be used instead. The Component respects many of the options you can define within jQuery DataTables settings such as bSearchable and bSortable on a per field basis.

With ContainableBehavior:

    $this->paginate = array(
        'fields' => array('Field.A','Field.B', 'Field.C','AssocatiatedModal.D'),
        'conditions' => array(
            'active'=>1
        )
        'contain' => array('AssocatiatedModal')
    );
    $this->set('response', $this->DataTable->getResponse());
    $this->set('_serialize','response');

Using models from other controllers. Sometimes the case may be that you are in a CustomersController and you have a method within that wants to display data from another model such as an Order model. This can be accomplished with the following parameters:

$this->DataTable->getResponse(null,$this->Order);

Licensing

Code is licensed under the MIT License.

cakephp-datatable's People

Contributors

cnizzardini avatar anyeloamt-zz avatar ionas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.