eziiui Extension to use CGridView, CDetailView, CLinkPager with jquery-ui

  1. Documentation
  2. view
  3. controller
  4. Change Log

Version 1.0.12 for yii 1.1.7

Version 1.0.10 for yii 1.1.5

Version 1.0.9 optimized for yii 1.1.4, some enh and bug fix

Version 1.0.8 optimized for yii 1.1.3, css improved, NO MORE jqGrid

Version 1.0.7 optimized for yii 1.1.2

Version 1.0.4+ only for yii 1.1.1

Extension to use CGridView, CDetailView and CLinkPager with jquery-ui theme framework.

It includes a new jqGrid wrapper based on CJuiWidget from zii.

Put it in your extensions folder and use it like normal widget. Since it isn't extended from CJuiWidget, you need to include a jquery-ui css theme in your page or, to test, simply put a zii CJuiWidget (CJuiTabs for example) before in order to auto-include a default theme.

For jqgrid you don't need to include any jquery-ui.css in the page (it uses zii jui default theme)

Tested (quickly) on FF 3.5.x, Google Chrome, IE8, IE7, IE6

Known issues:

  • IE6, IE7 pager buttons spacing and dimensions are not the same as in FF

jqGrid is a bit more than a wrapper. Feel free to help me to improve it!

Documentation

Requirements
  • Version 1.0.4+ Yii 1.1.1+
  • Yii 1.1.0 or above
Installation
  • Extract the release file under protected/extensions
Usage

See the following code example:

// use 'ext.eziiui.grid.CGridViewUI' from version 1.0.4
$this->widget('ext.eziiui.CGridViewUI', array(
    'dataProvider'=>$model,
    'columns'=>array(
        'column1',
        //......
    ),
));

$this->widget('ext.eziiui.CDetailViewUI', array(
    'data'=>$model,
    'attributes'=>array(
        'id',   
        'column1',
    ),
));
CJuiJqGrid

view

$this->widget('ext.eziiui.jqgrid.CJuiJqGrid', array(
    'modelClass'=>'Model', // used for columns label
    'htmlOptions'=>array(
        'id'=>'grid',
    ),
    'navbar'=>true,
    'options'=>array(
        'height'=>400,
        'autowidth'=>true,
        'datatype'=>'json',
        'url'=>Yii::app()->createUrl('index'), // ajax request for data
        'colNames'=>array('id','column1','column2'), // model attributes
//      'colModel'=>array( // optional, this is automatically generated from colNames if 'modelClass' is defined
//           array('index'=>'id','name'=>'id','hidden'=>true)
//           array('index'=>'column1','name'=>'column1')
//           array('index'=>'column2','name'=>'column2')
//      ),
        'rowNum'=>20,
        'rowList'=>array(20,50,100),
        'sortname'=>'column',
        'sortorder'=>"asc",
        'caption'=>"Grid title",
    )
)

controller

if (Yii::app()->request->isAjaxRequest) {
    $criteria=new CDbCriteria;
    $page = $_GET['page'];
    $limit = $_GET['rows'];
    $sidx = $_GET['sidx']; // get index row - i.e. user click to sort
    $sord = $_GET['sord']; // get the direction
    $dataProvider = new CActiveDataProvider('Model', array(
        'criteria'=>$criteria,
        'pagination'=>array(
            'currentPage'=>$page-1, // CActiveDataProvider is zero-based, jqGrid not
            'pageSize'=>$limit,
        ),
        'sort'=>array(
            'defaultOrder'=>"$sidx $sord",
        )
    ));
    $count = $dataProvider->totalItemCount;
    $total_pages=($count) ? $total_pages = ceil($count/$limit) : $total_pages = 0;
    // prepare json data for jqGrid
    $response->page = $page;
    $response->total = $total_pages;
    $response->records = $count;
    $data=$dataProvider->getData();
    foreach($data as $row) {
        $response->rows[]=array(
 	    'id'=>$row->id,
  	    'cell'=>array(
 	        $row->column1,
                $row->column2,
                //...
            )
        );
    }
    echo CJavaScript::jsonEncode($response);
}

Have a look inside CJuiJqGrid.php for more documentation

Change Log

April 28, 2011
1.0.12

Enh: update for yii-1.1.7

November 23, 2010
1.0.10

Enh: update for yii-1.1.5

November 5, 2010
1.0.9
  • Enh: added UHtml (builds input fields adding ui-corner-all class automatically)
  • Enh: added CActiveFormUI (same as CActiveForm but uses UHtml)
  • Enh: added CCheckBoxColumnUI.php (thanks to Corey Tisdale for fixing CCheckColumn select all css error)
  • Enh: CLinkPagerUI css improvements and bug fix
  • Ehn: CDetailViewUI added visible property
July 29, 2010
1.0.8
  • Enh: css improvements
  • Enh: added visible property to CDetailViewUI
  • ...: removed jqGrid... sorry but I don't use jqGrid, so I can't maintain it again.
May 3, 2010
1.0.7
  • Enh: CLinkPagerUI hover effect
  • Enh: css improvements
  • Enh: yii-1.1.2 support
March 15, 2010
1.0.6
  • Bug: CSS bug
1.0.5
  • Bug: Pagination bug solved
  • Enh: CGridViewUI now is derived from CBaseListUI
1.0.4
  • Upd: changed path from "eziiui.widgets.CGridViewUI" to "eziiui.widgets.grid.CGridViewUI"
  • Enh: yii 1.1.1 support
  • Enh: minor improvements
February 1, 2010
  • 1.0.3 added jqGrid wrapper based on CJuiWidget from zii
  • 1.0.2 some fixes and improvements (see CHANGELOG inside).
  • 1.0.1 removed filter property for 1.1.0 compatibility
January 31, 2010
  • 1.0.0 Initial release.
9 5
10 followers
4 685 downloads
Yii Version: 1.1
License: (not set)
Category: User Interface
Developed by: makro
Created on: Feb 1, 2010
Last updated: 7 years ago

Downloads

show all

Related Extensions