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 |
|---|---|---|---|
| 401 | Bujumbura | 2012/08/31 08:29:52 PM | |
| 402 | Bubanza | 2012/08/31 08:29:52 PM | |
| 403 | Bururi | 2012/08/31 08:29:52 PM | |
| 404 | Cankuzo | 2012/08/31 08:29:52 PM | |
| 405 | Cibitoke | 2012/08/31 08:29:52 PM | |
| 406 | Gitega | 2012/08/31 08:29:52 PM | |
| 407 | Karuzi | 2012/08/31 08:29:52 PM | |
| 408 | Kayanza | 2012/08/31 08:29:52 PM | |
| 409 | Kirundo | 2012/08/31 08:29:52 PM | |
| 410 | Makamba | 2012/08/31 08:29:52 PM | |
| 411 | Muyinga | 2012/08/31 08:29:52 PM | |
| 412 | Ngozi | 2012/08/31 08:29:52 PM | |
| 413 | Rutana | 2012/08/31 08:29:52 PM | |
| 414 | Ruyigi | 2012/08/31 08:29:52 PM | |
| 415 | Muramvya | 2012/08/31 08:29:52 PM | |
| 416 | Mwaro | 2012/08/31 08:29:52 PM | |
| 417 | Alibori | 2012/08/31 08:29:52 PM | |
| 418 | Atakora | 2012/08/31 08:29:52 PM | |
| 419 | Atlanyique | 2012/08/31 08:29:52 PM | |
| 420 | Borgou | 2012/08/31 08:29:52 PM | |
| 421 | Collines | 2012/08/31 08:29:52 PM | |
| 422 | Kouffo | 2012/08/31 08:29:52 PM | |
| 423 | Donga | 2012/08/31 08:29:52 PM | |
| 424 | Littoral | 2012/08/31 08:29:52 PM | |
| 425 | Mono | 2012/08/31 08:29:52 PM | |
| 426 | Oueme | 2012/08/31 08:29:52 PM | |
| 427 | Plateau | 2012/08/31 08:29:52 PM | |
| 428 | Zou | 2012/08/31 08:29:52 PM | |
| 429 | Devonshire | 2012/08/31 08:29:52 PM | |
| 430 | Hamilton | 2012/08/31 08:29:52 PM | |
| 431 | Paget | 2012/08/31 08:29:52 PM | |
| 432 | Pembroke | 2012/08/31 08:29:52 PM | |
| 433 | Saint George | 2012/08/31 08:29:52 PM | |
| 434 | Saint George's | 2012/08/31 08:29:52 PM | |
| 435 | Sandys | 2012/08/31 08:29:52 PM | |
| 436 | Smiths | 2012/08/31 08:29:52 PM | |
| 437 | Southampton | 2012/08/31 08:29:52 PM | |
| 438 | Warwick | 2012/08/31 08:29:52 PM | |
| 439 | Alibori | 2012/08/31 08:29:52 PM | |
| 440 | Belait | 2012/08/31 08:29:52 PM | |
| 441 | Brunei and Muara | 2012/08/31 08:29:52 PM | |
| 442 | Temburong | 2012/08/31 08:29:52 PM | |
| 443 | Collines | 2012/08/31 08:29:52 PM | |
| 444 | Kouffo | 2012/08/31 08:29:52 PM | |
| 445 | Donga | 2012/08/31 08:29:52 PM | |
| 446 | Littoral | 2012/08/31 08:29:52 PM | |
| 447 | Tutong | 2012/08/31 08:29:52 PM | |
| 448 | Oueme | 2012/08/31 08:29:52 PM | |
| 449 | Plateau | 2012/08/31 08:29:52 PM | |
| 450 | Zou | 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;}'
)
)
),
),
)
);