# Making a CGridView row clickable.

Last updated:

This is how you would make each row of you CGridView a link to the item displayed in it. The most important configurations is selectionChanged.

<?php
$this->widget('zii.widgets.grid.CGridView',array( 'id'=>'items-grid', 'dataProvider'=>$items,
'selectionChanged'=>"function(id){window.location='"
.Yii::app()->urlManager->createUrl('item/view',array('id'=>''))."' +
\$.fn.yiiGridView.getSelection(id);}",
'columns'=>array(
//more stuff.....