2017 © Pedro Peláez
 

library grid-dataprovider

image

witooh/grid-dataprovider

  • Tuesday, July 30, 2013
  • by witooh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 59 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Grid DataProvider

Installation

add in app.config, (*1)

return array(
    'providers'=>array(
        ...
        ...
        'Witooh\GridDataprovider\GridDataproviderServiceProvider',
    ),

    'alias'=>array(
        '''
        ...
        'JqGrid' => 'Witooh\GridDataprovider\Facades\JqGrid',
    ),
);

Usage

There are 2 classes have to use - Criteria - JqGrid, (*2)

Example, (*3)

public function dataProvider()
    {
        //Create new Criteria with table name
        $criteria = new Criteria('Post');

        //If title is not empty, it will generate sql where (AND) condition
        $criteria->compare('title', Input::get('title'));

        //If content is not empty, it will generate sql where (OR) condition
        $criteria->orCompare('title', Input::get('content'));

        //use Laravel Query Builder
        $criteria->query->leftJoin('comment', 'comment.post_id', '=', 'post.id');

        //make the JqGrid dataprovider
        //Dont care of the parameter which jqgrid send to the sever
        //This class will detected Input by itself.
        //Frist param is the criteria object
        //Second param is primary_key for jqgrid default is 'id'
        //return data array
        return JqGrid::make($criteria, 'post.id');
    }

The Versions

30/07 2013

dev-master

9999999-dev

  Sources   Download

The Requires

 

by Avatar witooh