0

I have a Yii booster TbRelationalColumn and it work perfectly, now when the records are more, the pagination is showing correctly but when i change the page the whole grid disappears and only that grid is showing which is currently selected, i have to refresh the page to get back all the related columns. Here is my code:

$this->widget('bootstrap.widgets.TbExtendedGridView', array(
            'filter'=>$model,
            'dataProvider' => $model->search(),
             'pager'=>array(
                'firstPageCssClass'=>'previous',
                'lastPageCssClass'=>'next',
                ),
            'columns' => array_merge(array(
             array('class'=>'bootstrap.widgets.TbRelationalColumn',
                    'name' => 'name',
             'url' =>$this->createUrl('XXXXXXX'),
             'value'=> $data->name
              )
            ),array( 'XXXXXX','XXXXXX',
    array(
        'class'=>'CButtonColumn',
        'template'=>'{update}',
        'buttons'=>array(
        'update' => array(
        'label'=>'',
        'imageUrl'=>Yii::app()->request->baseUrl.'/images/update.png',
      ),
     ),
),
  )),
));

Now the problem is that how can i maintain the current view when we change the page only related columns page is change not the whole grid?

Sudhanshu Saxena
  • 1,199
  • 12
  • 32
  • http://stackoverflow.com/a/14523154/428543. Also do your grid's have different `id`s? – topher Jun 04 '13 at 05:56
  • @topher not worked.I have each tr with different ID's but when i select next page in related table, the other tables vanished. – Sudhanshu Saxena Jun 04 '13 at 06:08
  • In addition to the filters,buttons and headers, you also have to add different css classes to the pagination. – topher Jun 04 '13 at 06:43

1 Answers1

0

Note: add this line 'template' => "{items}{pager}{summary}",

For Example Below:

$this->widget('booster.widgets.TbExtendedGridView', array(
    'filter'=>$model,
    'id'=>'mail-read-history-grid',
    'type'=>'striped bordered',
    'dataProvider' => $gridDataProvider,
    'template' => "{items}{pager}{summary}",
    'enableSorting' => false,
    'columns' => array_merge(array(
        array(
            'class'=>'booster.widgets.TbRelationalColumn',
            'name' => 'read_datetime',
            'url' => $this->createUrl('site/relational'),
            'value'=> '"test-subgrid"',
            'afterAjaxUpdate' => 'js:function(tr,rowid,data){
                bootbox.alert("I have afterAjax events too! This will only happen once for row with id: "+rowid);
            }'
        )
    ),$gridColumns),
));
Ram Pukar
  • 1,583
  • 15
  • 17