1

In Yii, I listed my table which is fetch from database in grid view.

'value'=> 'CHtml::radioButton("set_default",false,array(
             "value"=>"$data->id",
             "set"=>"1",
             "disable"=>"disable",
              "uncheckValue"=>null  
            ))',

the above code I entered in normal radio button view, how do I fetch from database? Anybody help me?

hamed
  • 7,939
  • 15
  • 60
  • 114

1 Answers1

0

CGridView lets you write any value inside row's column instead of normal database values. For modify column values, you need to add a function for value attribute. Inside of this function, you can access each data's attributes. In your case, You need to echo a radio button like this:

 //$data refres to each data row in the CGridView
'value' => function ($data, $row) {
        echo  
        CHtml::radioButton("set_default",false,array(
            "value"=>$data->id,
            "set"=>"1",
            "disable"=>"disable",
            "uncheckValue"=>null  
        )),                      
 },
hamed
  • 7,939
  • 15
  • 60
  • 114