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
 
1Alberta2012/08/31 08:29:52 PM
2British Columbia2012/08/31 08:29:52 PM
3Manitoba2012/08/31 08:29:52 PM
4New Brunswick2012/08/31 08:29:52 PM
5Newfoundland2012/08/31 08:29:52 PM
6Nova Scotia2012/08/31 08:29:52 PM
7Nunavut2012/08/31 08:29:52 PM
8Ontario2012/08/31 08:29:52 PM
9Prince Edward Island2012/08/31 08:29:52 PM
10Quebec2012/08/31 08:29:52 PM
11Saskatchewan2012/08/31 08:29:52 PM
12Northwest Territories2012/08/31 08:29:52 PM
13Yukon Territory2012/08/31 08:29:52 PM
14Armed Forces Americas2012/08/31 08:29:52 PM
15Armed Forces Europe, Middle East, & Canada2012/08/31 08:29:52 PM
16Alaska2012/08/31 08:29:52 PM
17Alabama2012/08/31 08:29:52 PM
18Armed Forces Pacific2012/08/31 08:29:52 PM
19Arkansas2012/08/31 08:29:52 PM
20American Samoa2012/08/31 08:29:52 PM
21Arizona2012/08/31 08:29:52 PM
22California2012/08/31 08:29:52 PM
23Colorado2012/08/31 08:29:52 PM
24Connecticut2012/08/31 08:29:52 PM
25District of Columbia2012/08/31 08:29:52 PM
26Delaware2012/08/31 08:29:52 PM
27Florida2012/08/31 08:29:52 PM
28Federated States of Micronesia2012/08/31 08:29:52 PM
29Georgia2012/08/31 08:29:52 PM
30Guam2012/08/31 08:29:52 PM
31Hawaii2012/08/31 08:29:52 PM
32Iowa2012/08/31 08:29:52 PM
33Idaho2012/08/31 08:29:52 PM
34Illinois2012/08/31 08:29:52 PM
35Indiana2012/08/31 08:29:52 PM
36Kansas2012/08/31 08:29:52 PM
37Kentucky2012/08/31 08:29:52 PM
38Louisiana2012/08/31 08:29:52 PM
39Massachusetts2012/08/31 08:29:52 PM
40Maryland2012/08/31 08:29:52 PM
41Maine2012/08/31 08:29:52 PM
42Marshall Islands2012/08/31 08:29:52 PM
43Michigan2012/08/31 08:29:52 PM
44Minnesota2012/08/31 08:29:52 PM
45Missouri2012/08/31 08:29:52 PM
46Northern Mariana Islands2012/08/31 08:29:52 PM
47Mississippi2012/08/31 08:29:52 PM
48Montana2012/08/31 08:29:52 PM
49North Carolina2012/08/31 08:29:52 PM
50North Dakota2012/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;}'
                    )
                )
            ),
        ),
    )
);