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 |
|---|---|---|---|
| 451 | Chuquisaca | 2012/08/31 08:29:52 PM | |
| 452 | Cochabamba | 2012/08/31 08:29:52 PM | |
| 453 | El Beni | 2012/08/31 08:29:52 PM | |
| 454 | La Paz | 2012/08/31 08:29:52 PM | |
| 455 | Oruro | 2012/08/31 08:29:52 PM | |
| 456 | Pando | 2012/08/31 08:29:52 PM | |
| 457 | Potosi | 2012/08/31 08:29:52 PM | |
| 458 | Santa Cruz | 2012/08/31 08:29:52 PM | |
| 459 | Tarija | 2012/08/31 08:29:52 PM | |
| 460 | Acre | 2012/08/31 08:29:52 PM | |
| 461 | Alagoas | 2012/08/31 08:29:52 PM | |
| 462 | Amapa | 2012/08/31 08:29:52 PM | |
| 463 | Amazonas | 2012/08/31 08:29:52 PM | |
| 464 | Bahia | 2012/08/31 08:29:52 PM | |
| 465 | Ceara | 2012/08/31 08:29:52 PM | |
| 466 | Distrito Federal | 2012/08/31 08:29:52 PM | |
| 467 | Espirito Santo | 2012/08/31 08:29:52 PM | |
| 468 | Mato Grosso do Sul | 2012/08/31 08:29:52 PM | |
| 469 | Maranhao | 2012/08/31 08:29:52 PM | |
| 470 | Mato Grosso | 2012/08/31 08:29:52 PM | |
| 471 | Minas Gerais | 2012/08/31 08:29:52 PM | |
| 472 | Para | 2012/08/31 08:29:52 PM | |
| 473 | Paraiba | 2012/08/31 08:29:52 PM | |
| 474 | Parana | 2012/08/31 08:29:52 PM | |
| 475 | Piaui | 2012/08/31 08:29:52 PM | |
| 476 | Rio de Janeiro | 2012/08/31 08:29:52 PM | |
| 477 | Rio Grande do Norte | 2012/08/31 08:29:52 PM | |
| 478 | Rio Grande do Sul | 2012/08/31 08:29:52 PM | |
| 479 | Rondonia | 2012/08/31 08:29:52 PM | |
| 480 | Roraima | 2012/08/31 08:29:52 PM | |
| 481 | Santa Catarina | 2012/08/31 08:29:52 PM | |
| 482 | Sao Paulo | 2012/08/31 08:29:52 PM | |
| 483 | Sergipe | 2012/08/31 08:29:52 PM | |
| 484 | Goias | 2012/08/31 08:29:52 PM | |
| 485 | Pernambuco | 2012/08/31 08:29:52 PM | |
| 486 | Tocantins | 2012/08/31 08:29:52 PM | |
| 487 | Bimini | 2012/08/31 08:29:52 PM | |
| 488 | Cat Island | 2012/08/31 08:29:52 PM | |
| 489 | Exuma | 2012/08/31 08:29:52 PM | |
| 490 | Inagua | 2012/08/31 08:29:52 PM | |
| 491 | Long Island | 2012/08/31 08:29:52 PM | |
| 492 | Mayaguana | 2012/08/31 08:29:52 PM | |
| 493 | Ragged Island | 2012/08/31 08:29:52 PM | |
| 494 | Harbour Island | 2012/08/31 08:29:52 PM | |
| 495 | New Providence | 2012/08/31 08:29:52 PM | |
| 496 | Acklins and Crooked Islands | 2012/08/31 08:29:52 PM | |
| 497 | Freeport | 2012/08/31 08:29:52 PM | |
| 498 | Fresh Creek | 2012/08/31 08:29:52 PM | |
| 499 | Governor's Harbour | 2012/08/31 08:29:52 PM | |
| 500 | Green Turtle Cay | 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;}'
)
)
),
),
)
);