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 |
|---|---|---|---|
| 351 | Tuy | 2012/08/31 08:29:52 PM | |
| 352 | Yagha | 2012/08/31 08:29:52 PM | |
| 353 | Yatenga | 2012/08/31 08:29:52 PM | |
| 354 | Ziro | 2012/08/31 08:29:52 PM | |
| 355 | Zondoma | 2012/08/31 08:29:52 PM | |
| 356 | Mikhaylovgrad | 2012/08/31 08:29:52 PM | |
| 357 | Blagoevgrad | 2012/08/31 08:29:52 PM | |
| 358 | Burgas | 2012/08/31 08:29:52 PM | |
| 359 | Dobrich | 2012/08/31 08:29:52 PM | |
| 360 | Gabrovo | 2012/08/31 08:29:52 PM | |
| 361 | Grad Sofiya | 2012/08/31 08:29:52 PM | |
| 362 | Khaskovo | 2012/08/31 08:29:52 PM | |
| 363 | Kurdzhali | 2012/08/31 08:29:52 PM | |
| 364 | Kyustendil | 2012/08/31 08:29:52 PM | |
| 365 | Lovech | 2012/08/31 08:29:52 PM | |
| 366 | Montana | 2012/08/31 08:29:52 PM | |
| 367 | Pazardzhik | 2012/08/31 08:29:52 PM | |
| 368 | Pernik | 2012/08/31 08:29:52 PM | |
| 369 | Pleven | 2012/08/31 08:29:52 PM | |
| 370 | Plovdiv | 2012/08/31 08:29:52 PM | |
| 371 | Razgrad | 2012/08/31 08:29:52 PM | |
| 372 | Ruse | 2012/08/31 08:29:52 PM | |
| 373 | Shumen | 2012/08/31 08:29:52 PM | |
| 374 | Silistra | 2012/08/31 08:29:52 PM | |
| 375 | Sliven | 2012/08/31 08:29:52 PM | |
| 376 | Smolyan | 2012/08/31 08:29:52 PM | |
| 377 | Sofiya | 2012/08/31 08:29:52 PM | |
| 378 | Stara Zagora | 2012/08/31 08:29:52 PM | |
| 379 | Turgovishte | 2012/08/31 08:29:52 PM | |
| 380 | Varna | 2012/08/31 08:29:52 PM | |
| 381 | Veliko Turnovo | 2012/08/31 08:29:52 PM | |
| 382 | Vidin | 2012/08/31 08:29:52 PM | |
| 383 | Vratsa | 2012/08/31 08:29:52 PM | |
| 384 | Yambol | 2012/08/31 08:29:52 PM | |
| 385 | Al Hadd | 2012/08/31 08:29:52 PM | |
| 386 | Al Manamah | 2012/08/31 08:29:52 PM | |
| 387 | Jidd Hafs | 2012/08/31 08:29:52 PM | |
| 388 | Sitrah | 2012/08/31 08:29:52 PM | |
| 389 | Al Mintaqah al Gharbiyah | 2012/08/31 08:29:52 PM | |
| 390 | Mintaqat Juzur Hawar | 2012/08/31 08:29:52 PM | |
| 391 | Al Mintaqah ash Shamaliyah | 2012/08/31 08:29:52 PM | |
| 392 | Al Mintaqah al Wusta | 2012/08/31 08:29:52 PM | |
| 393 | Madinat | 2012/08/31 08:29:52 PM | |
| 394 | Ar Rifa | 2012/08/31 08:29:52 PM | |
| 395 | Madinat Hamad | 2012/08/31 08:29:52 PM | |
| 396 | Al Muharraq | 2012/08/31 08:29:52 PM | |
| 397 | Al Asimah | 2012/08/31 08:29:52 PM | |
| 398 | Al Janubiyah | 2012/08/31 08:29:52 PM | |
| 399 | Ash Shamaliyah | 2012/08/31 08:29:52 PM | |
| 400 | Al Wusta | 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;}'
)
)
),
),
)
);