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 |
|---|---|---|---|
| 51 | Nebraska | 2012/08/31 08:29:52 PM | |
| 52 | New Hampshire | 2012/08/31 08:29:52 PM | |
| 53 | New Jersey | 2012/08/31 08:29:52 PM | |
| 54 | New Mexico | 2012/08/31 08:29:52 PM | |
| 55 | Nevada | 2012/08/31 08:29:52 PM | |
| 56 | New York | 2012/08/31 08:29:52 PM | |
| 57 | Ohio | 2012/08/31 08:29:52 PM | |
| 58 | Oklahoma | 2012/08/31 08:29:52 PM | |
| 59 | Oregon | 2012/08/31 08:29:52 PM | |
| 60 | Pennsylvania | 2012/08/31 08:29:52 PM | |
| 61 | Puerto Rico | 2012/08/31 08:29:52 PM | |
| 62 | Palau | 2012/08/31 08:29:52 PM | |
| 63 | Rhode Island | 2012/08/31 08:29:52 PM | |
| 64 | South Carolina | 2012/08/31 08:29:52 PM | |
| 65 | South Dakota | 2012/08/31 08:29:52 PM | |
| 66 | Tennessee | 2012/08/31 08:29:52 PM | |
| 67 | Texas | 2012/08/31 08:29:52 PM | |
| 68 | Utah | 2012/08/31 08:29:52 PM | |
| 69 | Virginia | 2012/08/31 08:29:52 PM | |
| 70 | Virgin Islands | 2012/08/31 08:29:52 PM | |
| 71 | Vermont | 2012/08/31 08:29:52 PM | |
| 72 | Washington | 2012/08/31 08:29:52 PM | |
| 73 | West Virginia | 2012/08/31 08:29:52 PM | |
| 74 | Wisconsin | 2012/08/31 08:29:52 PM | |
| 75 | Wyoming | 2012/08/31 08:29:52 PM | |
| 76 | Canillo | 2012/08/31 08:29:52 PM | |
| 77 | Encamp | 2012/08/31 08:29:52 PM | |
| 78 | La Massana | 2012/08/31 08:29:52 PM | |
| 79 | Ordino | 2012/08/31 08:29:52 PM | |
| 80 | Sant Julia de Loria | 2012/08/31 08:29:52 PM | |
| 81 | Andorra la Vella | 2012/08/31 08:29:52 PM | |
| 82 | Escaldes-Engordany | 2012/08/31 08:29:52 PM | |
| 83 | Abu Dhabi | 2012/08/31 08:29:52 PM | |
| 84 | Ajman | 2012/08/31 08:29:52 PM | |
| 85 | Dubai | 2012/08/31 08:29:52 PM | |
| 86 | Fujairah | 2012/08/31 08:29:52 PM | |
| 87 | Ras Al Khaimah | 2012/08/31 08:29:52 PM | |
| 88 | Sharjah | 2012/08/31 08:29:52 PM | |
| 89 | Umm Al Quwain | 2012/08/31 08:29:52 PM | |
| 90 | Badakhshan | 2012/08/31 08:29:52 PM | |
| 91 | Badghis | 2012/08/31 08:29:52 PM | |
| 92 | Baghlan | 2012/08/31 08:29:52 PM | |
| 93 | Bamian | 2012/08/31 08:29:52 PM | |
| 94 | Farah | 2012/08/31 08:29:52 PM | |
| 95 | Faryab | 2012/08/31 08:29:52 PM | |
| 96 | Ghazni | 2012/08/31 08:29:52 PM | |
| 97 | Ghowr | 2012/08/31 08:29:52 PM | |
| 98 | Helmand | 2012/08/31 08:29:52 PM | |
| 99 | Herat | 2012/08/31 08:29:52 PM | |
| 100 | Kabol | 2012/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;}'
)
)
),
),
)
);