Logic In Cgridview

hallo everybody…i have display of cgridview like this :

No | Jenis Surat | Isi | Lihat Surat |

  1. | A | blablabla AA | Lihat |

  2. | B | blablabla BBkj | Lihat |

  3. | C | blablabla CChv | Lihat |

  4. | B | blablabla BBbbb| Lihat |

i want to make action :

  1. when i click "lihat" in row "jenis surat A",. go to page A

  2. when i click "lihat" in row "jenis surat B",. go to page B

  3. when i click "lihat" in row "jenis surat C",. go to page C

Can anyone please let me know how to make logic in controller or model? Any help would be greatly appreciated :unsure:

Hi,

you can create URL from below code of line

‘url’=>’$this->grid->controller->createUrl(“actionname”, array(“id”=>$data->primaryKey,"_id"=>’.$model->_id.’))’,

thx for your response chandran…

but sorry where should i put that?and how about action in controller?

i try to make like this in cgridview :




array(

					'header'=>'View Naskah',

					'name'=>'aksi',

					'type'=>'raw',

					'value'=>'Chtml::linkButton("Lihat",array(\'submit\'=>array(\'naskah/surmas\',\'id\'=>$data->id_naskah)))',

					 

							//'filter'=>CHtml::activeTextField($model, 'jenisSurat'),

				  ),



and like this in controller :




public function actionSurmas()

	{ 

	

			if($this->id_jenissurat=1)

			{

				$this->redirect(array('A'));

			}

			else if($this->id_jenissurat=2)

			{

				$this->redirect(array('B'));

			}

			else

				$this->redirect(array('C'));

	}



but not work…

linkbutton usage

http://stackoverflow.com/questions/8161846/linkbutton-passing-variables

cgridview value is evaluated as expression… please follow the line

http://www.yiiframework.com/wiki/278/cgridview-render-customized-complex-datacolumns/