Preselected Rows On Cgridview Or Selgridview

Hi everybody,

Can I define the rows or IDs already selected on cgridview or selgridview?

Example:

a Grid that show all the employees with some already selected (the ones that are already belongs to a project record).

Many thanks

Hi,

in a CGridView you can specify a field like this:




array('header'=>'Défaut', 

   'name'=>'default', 

   'class'=>'CCheckBoxColumn',

   'value'=>'$data->class_id',

   'checked'=>function($data) {

       	if ($data->class_id == Yii::app()->user->getState('ClassDefault')) {

   		$default[] = '1';

       	}

	else {

		$default[] = '0';

	}

       	return implode(', ', $default);

   }, 

),