Hi,
I need help.
I am using ‘ext.selgridview.SelGridView’ widget in my project and using pagination too.
I can select/check manually some records and can get these items after.
I can uncheck all items, using ‘selGridView(“clearAllSelection”)’.
But I can’t select/check all records on this grid and don’t know how. I’ve got $model->id column, but how can I put this array into selGridView(‘addSelection’, [here!])?
view:
...
$this->widget('ext.selgridview.SelGridView', array(
'id'=>'dest-list-grid',
'dataProvider'=>$model->searchEvent($event_id),
'filter'=>$model,
'ajaxUpdate'=>true,
'selectableRows' => 2,
'enablePagination' => true,
'enableSorting'=> true,
'pagerCssClass' => 'text-center',
'pager'=>array(
'nextPageLabel' => '<span>»</span>',
'prevPageLabel' => '<span>«</span>',
'lastPageLabel' => '<span>»»</span>',
'firstPageLabel' => '<span>««</span>',
'selectedPageCssClass' => 'active',
'hiddenPageCssClass' => 'disabled',
'htmlOptions' => array('class' => 'pagination'),
'class' => 'CLinkPager',
'header' => false,
'pageSize' => 5,
),
'columns'=>array(
array(
'name'=>'checkrow',
'id'=>'selectedIDs',
'class'=>'CCheckBoxColumn',
'value'=>'$data->id',
'checkBoxHtmlOptions' => array('class' => 'checkclass',),
'disabled'=>'!$data->accept_id?"":"disabled"',
),
array(
'name'=>'id',
'header'=>'#',
'filter'=>'',
'value'=>'$data->id',
),
...
),
));
...
<script>
...
$(document).ready(function(){
$('#btn-selAllRecords').click(function() {
$('#dest-list-grid').selGridView('addSelection', [<?php implode(",", $model->id); ?>]);
//but this code doesn't work! <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/sad.gif' class='bbc_emoticon' alt=':(' />
});
});
...
</script>