silintzir
(Psilintziris)
December 2, 2011, 9:09am
1
I am using a CCheckboxColumn to be able to select multiple rows on a grid a set ‘selectableRows’ to 2 to have the check all checkboxes option. By default when the grid loads the checkAll is selected. Can I override this behavior??? I tried to use external js script to uncheck this button but it doesn’s work…
jacmoe
(Jacob Moena)
December 2, 2011, 9:16am
2
Doesn’t happen here.
Could you maybe post some relevant code?
mdomba
(Maurizio Domba Cerin)
December 2, 2011, 9:19am
3
Do you have any data in the grid… are the rows checkboxes all checked? what Yii version do you use ?
jacmoe
(Jacob Moena)
December 2, 2011, 9:27am
4
That could very well be the case.
In my code, I use a separate column:
array(
'id'=>'selectedItems',
'class'=>'CCheckBoxColumn',
),
If you tie it to an existing column, then they will of course be checked when the value is true. That is: everything but zero. Which is practically all of them.
silintzir
(Psilintziris)
December 2, 2011, 2:46pm
5
This is my code. I want the "Check All" checkbox not to be checked by default (I managed to achieve that with some jquery running on the beginning), but I also want after each update of the grid the "Check all" checkbox to be unchecked…
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $filter->search(),
'emptyText' => 'No data found.',
'id' => 'i9-cases-grid',
'filter' => $filter,
'afterAjaxUpdate' => 'js: function(){ $("#i9-cases-grid_c0_all").removeAttr("checked");}',
'itemsCssClass' => 'tableItems',
'columns' => array(
array(
'class' => 'CCheckBoxColumn',
'selectableRows' => 2,
'checkBoxHtmlOptions' => array(
'name' => 'ids[]',
),
),
jacmoe
(Jacob Moena)
December 2, 2011, 9:36pm
6
Something is totally wrong.
The checkboxes should never, ever be checked by default.
Unless something is wrong.
This works for me:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'issue-grid',
'dataProvider'=>$model->search(),
'selectableRows'=>2,
'columns'=>array(
array(
'id'=>'selectedItems',
'class'=>'CCheckBoxColumn',
),
array(
'name' => 'id',
'header' => 'Id',
Make sure that the checkbox column is separate and not tied to any data column.
capsuline
(Robinkouwen)
November 12, 2013, 3:00pm
7
jacmoe:
Something is totally wrong.
The checkboxes should never, ever be checked by default.
Unless something is wrong.
This works for me:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'issue-grid',
'dataProvider'=>$model->search(),
'selectableRows'=>2,
'columns'=>array(
array(
'id'=>'selectedItems',
'class'=>'CCheckBoxColumn',
),
array(
'name' => 'id',
'header' => 'Id',
Make sure that the checkbox column is separate and not tied to any data column.
This works fine for me.
But on the same subject.
I’m trying to select all rows including the one’s on page 2 and 3.
Is there a way to do this?
Disabling pagination is not an option for me.
Any other ideas ?