i need to know can we use sessions in cgridview to store the value obatined.
something like
in view
// cgridview
..........
' name',
array
('header'=>'ID',
'value'=>'Yii::app()->SESSION['id']=$data["rid"]'),
.......
this is my gridview
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataP10,
'ajaxUpdate'=>true,
'columns'=>array(
array('name'=>' Name','value'=>'$data["name"]'),
array('name'=>' createdate','value'=>'$data["createdate"]'),
array(
'class'=>'CButtonColumn',
'template'=>'{view}',
'buttons'=>array(
'view'=>array(
'url'=>'Yii::app()- >createUrl("controller/action",array("id"=>$data["id"]))',
),
),
),
),
));
?>
here data["id"] i dont want it to be querystring but something in session for that particular record its id to be in session
'view'=>array(
'url'=>'Yii::app()- >createUrl("controller/action",array("id"=>$data["id"]))',
),
can anyone let me know can this happen if so then do suggest your guidance
Your grid definition is mystery to me !
What I think you need is sth like this, ajax event on cbuttoncolumn
In the controller you have to define a function e. g
Controller
Now given your comments down I am puzzled , you want to click on the record and --> Add the respective record id to session --> View the record
If you need to perform both actions you just need to put this at the top of view funciton e.g
function view($id){ //check if record found $_SESSION['id']=$id; ... reset of the code }else see above code where you have two buttons one to set the value to session other to view the record . You need to be clear about the flow of actions first .