JSON Grid View

Basic example of usage

The following grid, displays 50 rows on each page from a table of around 4000 records (not indexed).

Note This widget requires special server config:
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
	header( 'Content-type: application/json' );
	$this->renderPartial('_grid', compact('model'));
	Yii::app()->end();
}
ID Name Create Time Edit
 
1993Aakk,r2012/08/31 08:29:52 PM
587Aargau2012/08/31 08:29:52 PM
1284Abashis Raioni2012/08/31 08:29:52 PM
1224Aberdeen City2012/08/31 08:29:52 PM
1225Aberdeenshire2012/08/31 08:29:52 PM
2578Abia2012/08/31 08:29:52 PM
1285Abkhazia2012/08/31 08:29:52 PM
2747Abra2012/08/31 08:29:52 PM
1767Abruzzi2012/08/31 08:29:52 PM
214Abseron2012/08/31 08:29:52 PM
83Abu Dhabi2012/08/31 08:29:52 PM
3893Abyan2012/08/31 08:29:52 PM
1591Aceh2012/08/31 08:29:52 PM
496Acklins and Crooked Islands2012/08/31 08:29:52 PM
3329Acquaviva2012/08/31 08:29:52 PM
460Acre2012/08/31 08:29:52 PM
2684Ad Dakhiliyah2012/08/31 08:29:52 PM
943Ad Daqahliyah2012/08/31 08:29:52 PM
2945Ad Dawhah2012/08/31 08:29:52 PM
652Adamaoua2012/08/31 08:29:52 PM
2569Adamawa2012/08/31 08:29:52 PM
3894Adan2012/08/31 08:29:52 PM
3610Adana2012/08/31 08:29:52 PM
1286Adigenis Raioni2012/08/31 08:29:52 PM
992Adis Abeba2012/08/31 08:29:52 PM
3542Adiyaman2012/08/31 08:29:52 PM
3716Adjumani2012/08/31 08:29:52 PM
2383Adrar2012/08/31 08:29:52 PM
877Adrar2012/08/31 08:29:52 PM
3000Adygeya, Republic of2012/08/31 08:29:52 PM
993Afar2012/08/31 08:29:52 PM
3543Afyonkarahisar2012/08/31 08:29:52 PM
2547Agadez2012/08/31 08:29:52 PM
2401Agalega Islands2012/08/31 08:29:52 PM
215Agcabadi2012/08/31 08:29:52 PM
216Agdam2012/08/31 08:29:52 PM
217Agdas2012/08/31 08:29:52 PM
3001Aginsky Buryatsky AO2012/08/31 08:29:52 PM
613Agneby2012/08/31 08:29:52 PM
3544Agri2012/08/31 08:29:52 PM
218Agstafa2012/08/31 08:29:52 PM
219Agsu2012/08/31 08:29:52 PM
2451Aguascalientes2012/08/31 08:29:52 PM
2748Agusan del Norte2012/08/31 08:29:52 PM
2749Agusan del Sur2012/08/31 08:29:52 PM
3510Ahal2012/08/31 08:29:52 PM
3379Ahuachapan2012/08/31 08:29:52 PM
3537Aiana2012/08/31 08:29:52 PM
1810Aichi2012/08/31 08:29:52 PM
3883Aiga-i-le-Tai2012/08/31 08:29:52 PM
$this->widget(
    'booster.widgets.TbJsonGridView',
    array(
        'dataProvider' => $model->search(),
        'filter' => $model,
        'type' => 'striped bordered condensed',
        'summaryText' => false,
        'cacheTTL' => 10, // cache will be stored 10 seconds (see cacheTTLType)
        'cacheTTLType' => 's', // type can be of seconds, minutes or hours
        'columns' => array(
            'id',
            'name',
            array(
                'name' => 'create_time',
                'type' => 'datetime'
            ),
            array(
                'header' => Yii::t('ses', 'Edit'),
                'class' => 'booster.widgets.TbJsonButtonColumn',
                'template' => '{view} {delete}',
                'viewButtonUrl' => null,
                'updateButtonUrl' => null,
                'deleteButtonUrl' => null,
                'buttons' => array(
                    'delete' => array(
                        'click' => 'function(){return false;}'
                    )
                )
            ),
        ),
    )
);