ubgsdnhfj
ubgsdnhfj

Reputation: 70

Yii EColumnsDialog annother error

array(
               'header' => 'checkbox',
               'value' => '(!$data->checkbox_one) ? CHtml::checkbox($data->id, false, array("class" => "check_one", "id" => $data->id)) : ""',
               'type' => 'raw',
               'value'=>function($data){
                   (!$data->checkbox_one) ? CHtml::checkbox($data->id, false, array("class" => "check_one", "id" => $data->id)) : "";
                   (!$data->checkbox_two) ? CHtml::checkbox($data->id, false, array("class" => "check_two", "id" => $data->id)) : "";
               }
           ),

needs to display the two or more "checkbox" in one table, normally through the "echo" I am able to display the text like this: Yii add text before the value in EColumnsDialog

and how am I supposed to do with "checkbox"?

Upvotes: 0

Views: 60

Answers (2)

Dinistro
Dinistro

Reputation: 5730

If you're using an anonymous function you need to return your value:

'value' => function($data){
    $result = (!$data->checkbox_one) ? CHtml::checkbox($data->id, false, array("class" => "check_one", "id" => $data->id)) : "";
    echo $result.((!$data->checkbox_two) ? CHtml::checkbox($data->id, false, array("class" => "check_two", "id" => $data->id)) : "");
}

Upvotes: 1

ubgsdnhfj
ubgsdnhfj

Reputation: 70

        'value' => function($data){
    $result = (!$data->checkbox_one) ? CHtml::checkbox($data->id, false, array("class" => "check_one", "id" => $data->id)) : "";
$result2 = (!$data->checkbox_two) ? CHtml::checkbox($data->id, false, array("class" => "check_two", "id" => $data->id)) : "";
    echo $result.$result2;

    }

works only in this way, but thanks for the answer :)

Upvotes: 0

Related Questions