I am using Yii 1.x with the selgridview extension which simply remembers selected rows when sorting or paging. The demo here demonstrates exactly what this does - http://www.yiiframework.com/extension/selgridview/
I have followed the instructions and while it does work, it doesn’t work 100% as per the demo above.
I have a grid which has 21 rows which spans over 3 pages in the pager (e.g 10 rows per page).
When I attempt to select an checkbox & then go to another page in the pager and then go back to the initial checkbox it is no longer checked.
For instance if I select checkbox ‘4’ on page 1, then navigate to the 3 page in the pager and then return back to page 1 the checkbox 4 is no longer checked (even though I just checked this). I have the ‘checked’ parameter in the widget pulling in an array of pre-selected checkboxes. This is just a standard array e.g Array ( [0] => 5454 [1] => 11402 [2] => 11481 )
This will simply pre-select a number of checkboxes on page load (this element works fine), I cannot understand why when I check a checkbox and navigate to another page of the grid recordset it loses the selection I have just made.
My $_GET request appears as follows:
Could anyone provide any advice? Please let me know if my query is unclear i’d be happy to expand further
I am using Yii version 1.1.14
// form view below
<div class="controls">
<?php $this->widget('ext.selgridview.BootSelGridView',array(
'id' => 'teachers-grid',
'type' => 'striped bordered condensed',
'dataProvider' => new CArrayDataProvider($model->getAvailableTeachers(), array(
'keyField' => 'user_id'
)),
'selectableRows' => true,
'columns' => array(
array(
'id' => 'user_id',
'class' => 'CCheckBoxColumn',
'checked' => 'in_array($data->user_id, $this->grid->owner->model->teacher_ids)',
'checkBoxHtmlOptions' => array(
'name' => get_class($model)."[teachers][]"
)
),
'user_id',
'email',
)
)); ?>
</div>