checked checkbox dynamically

<?php

$this->widget(‘zii.widgets.grid.CGridView’, array(

'id'=&gt;'user-grid',


'dataProvider'=&gt;&#036;pMethods,


'columns'=&gt;array(


	array(


		'name'=&gt;'ID', 


		'value' =&gt; 'CHtml::checkBox(&quot;paymentMethods[]&quot;,false,array(&quot;value&quot;=&gt;&#036;data[&quot;id&quot;]))',


		'type'=&gt;'raw',


	),


	'type',


	'description',


)

));

?>

same code used for add/edit the payment methods, problem is how to checked the checkbox in edit mode that user added previously mean to say how marked a checkbox dynamically.

why not use CCheckBoxColumn

http://www.yiiframework.com/doc/api/1.1/CCheckBoxColumn/

it will be:




<?php

$this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'user-grid',

	'dataProvider'=>$pMethods,

	'columns'=>array(

			array(

			'name'	=>'ID',

			'class'	=> 'CCheckBoxColumn',

			'checked' => '$data["id"]',

			'selectableRows'=>2, // multiple selected row

			),

		'type',

		'description',

		)

));

?>



how can we apply loop on added values to check which box is going to ON??