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 |
|---|---|---|---|
| 301 | Hainaut | 2012/08/31 08:29:52 PM | |
| 302 | Liege | 2012/08/31 08:29:52 PM | |
| 303 | Limburg | 2012/08/31 08:29:52 PM | |
| 304 | Luxembourg | 2012/08/31 08:29:52 PM | |
| 305 | Namur | 2012/08/31 08:29:52 PM | |
| 306 | Oost-Vlaanderen | 2012/08/31 08:29:52 PM | |
| 307 | West-Vlaanderen | 2012/08/31 08:29:52 PM | |
| 308 | Brabant Wallon | 2012/08/31 08:29:52 PM | |
| 309 | Brussels Hoofdstedelijk Gewest | 2012/08/31 08:29:52 PM | |
| 310 | Vlaams-Brabant | 2012/08/31 08:29:52 PM | |
| 311 | Bam | 2012/08/31 08:29:52 PM | |
| 312 | Boulkiemde | 2012/08/31 08:29:52 PM | |
| 313 | Ganzourgou | 2012/08/31 08:29:52 PM | |
| 314 | Gnagna | 2012/08/31 08:29:52 PM | |
| 315 | Kouritenga | 2012/08/31 08:29:52 PM | |
| 316 | Oudalan | 2012/08/31 08:29:52 PM | |
| 317 | Passore | 2012/08/31 08:29:52 PM | |
| 318 | Sanguie | 2012/08/31 08:29:52 PM | |
| 319 | Soum | 2012/08/31 08:29:52 PM | |
| 320 | Tapoa | 2012/08/31 08:29:52 PM | |
| 321 | Zoundweogo | 2012/08/31 08:29:52 PM | |
| 322 | Bale | 2012/08/31 08:29:52 PM | |
| 323 | Banwa | 2012/08/31 08:29:52 PM | |
| 324 | Bazega | 2012/08/31 08:29:52 PM | |
| 325 | Bougouriba | 2012/08/31 08:29:52 PM | |
| 326 | Boulgou | 2012/08/31 08:29:52 PM | |
| 327 | Gourma | 2012/08/31 08:29:52 PM | |
| 328 | Houet | 2012/08/31 08:29:52 PM | |
| 329 | Ioba | 2012/08/31 08:29:52 PM | |
| 330 | Kadiogo | 2012/08/31 08:29:52 PM | |
| 331 | Kenedougou | 2012/08/31 08:29:52 PM | |
| 332 | Komoe | 2012/08/31 08:29:52 PM | |
| 333 | Komondjari | 2012/08/31 08:29:52 PM | |
| 334 | Kompienga | 2012/08/31 08:29:52 PM | |
| 335 | Kossi | 2012/08/31 08:29:52 PM | |
| 336 | Koulpelogo | 2012/08/31 08:29:52 PM | |
| 337 | Kourweogo | 2012/08/31 08:29:52 PM | |
| 338 | Leraba | 2012/08/31 08:29:52 PM | |
| 339 | Loroum | 2012/08/31 08:29:52 PM | |
| 340 | Mouhoun | 2012/08/31 08:29:52 PM | |
| 341 | Namentenga | 2012/08/31 08:29:52 PM | |
| 342 | Naouri | 2012/08/31 08:29:52 PM | |
| 343 | Nayala | 2012/08/31 08:29:52 PM | |
| 344 | Noumbiel | 2012/08/31 08:29:52 PM | |
| 345 | Oubritenga | 2012/08/31 08:29:52 PM | |
| 346 | Poni | 2012/08/31 08:29:52 PM | |
| 347 | Sanmatenga | 2012/08/31 08:29:52 PM | |
| 348 | Seno | 2012/08/31 08:29:52 PM | |
| 349 | Sissili | 2012/08/31 08:29:52 PM | |
| 350 | Sourou | 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;}'
)
)
),
),
)
);