Yii Framework Forum: Update selected checkbox - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Update selected checkbox Rate Topic: -----

#1 User is offline   neel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 133
  • Joined: 08-October 09

Posted 02 March 2010 - 10:59 AM

I have checkbox per row and want to update selected checkbox. Controller action is not working, can anyone help me.

Here is my view file
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
'id',
array(
'name'=>'Action', 'value'=>'CHtml::checkBox("cid[]",null,array("value"=>$data->id,"id"=>"cid_".$data->id))',
'type'=>'raw',
'htmlOptions'=>array('width'=>5),
//'visible'=>false,
),
'name',
'email',
),
)); ?>
0

#2 User is offline   nemo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 24-February 10

Posted 03 March 2010 - 09:51 AM

I am facing same problem. If anyone help that will be great.
0

#3 User is offline   vamp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 181
  • Joined: 30-January 09

Posted 03 March 2010 - 09:59 AM

please, specify what do you mean, saying "update selected checkbox" - you need check/uncheck checkbox and you know it id?
-Posted Image-
Thanks, you make me stronger!
0

#4 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 03 March 2010 - 10:01 AM

There is a checkbox column type already existing:
CCheckBoxColumn

Theoretically this should fix your issue if implemented :-)

Example usage in another forum post:
http://www.yiiframew...ablerows-quirk/
Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#5 User is offline   nemo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 24-February 10

Posted 03 March 2010 - 10:09 AM

View Postvamp, on 03 March 2010 - 09:59 AM, said:

please, specify what do you mean, saying "update selected checkbox" - you need check/uncheck checkbox and you know it id?

Suppose I have 100 data and select 5 data using checkbox to assign to my User_id. Is that possible.

Here is my view file

<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
'id',
array(
'name'=>'Action',
'value'=>'CHtml::checkBox("cid[]",null,array("update","value"=>$data->id,"id"=>"cid_".$data->id))',
,
'type'=>'raw',
'htmlOptions'=>array('width'=>5),
//'visible'=>false,
),
'item1',
'item2',
),
)); ?>

I really appreciate if any one help me about controller action file.
0

#6 User is offline   nemo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 24-February 10

Posted 06 March 2010 - 07:53 PM

View Postintel352, on 03 March 2010 - 10:01 AM, said:

There is a checkbox column type already existing:
CCheckBoxColumn

Theoretically this should fix your issue if implemented :-)

Example usage in another forum post:
http://www.yiiframew...ablerows-quirk/


Can you help me with example? I really need that to implement my website.
0

#7 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 08 March 2010 - 05:30 PM

View Postnemo, on 06 March 2010 - 07:53 PM, said:

Can you help me with example? I really need that to implement my website.


Please refer to my previous post:

View Postintel352, on 03 March 2010 - 10:01 AM, said:

There is a checkbox column type already existing:
CCheckBoxColumn

Example usage in another forum post:
http://www.yiiframew...ablerows-quirk/

Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#8 User is offline   nemo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 24-February 10

Posted 08 March 2010 - 05:49 PM

View Postintel352, on 08 March 2010 - 05:30 PM, said:

Please refer to my previous post:

Can you help me with example code?
0

#9 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 08 March 2010 - 05:58 PM

View Postnemo, on 08 March 2010 - 05:49 PM, said:

Can you help me with example code?


I've not used it yet myself, but there is example code in the post that I linked to in my prior posts.
Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#10 User is offline   nemo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 24-February 10

Posted 08 March 2010 - 06:13 PM

View Postintel352, on 08 March 2010 - 05:58 PM, said:

I've not used it yet myself, but there is example code in the post that I linked to in my prior posts.

Can you tell me how to create button or link for delete/update on the top?

<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'showTableOnEmpty'=>false,
'selectableRows'=>2,
'emptyText'=>'Nowt to see.',
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
'name'=>'delete',
'value'=>'$data->id',
'id'=>'delete'
),
'name',
'loginName',
'password',
'email',
),
)); ?>
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users