I’m trying to update 2 fields from a CJuiDialog using an onclick button. Using just the $data->id it works, however when I replace it with $data->rate($date)[“test”] it fails - even though data->rate($date)[“test”] works in the comparison immediately prior to passing the variable to the onclick.
Works:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'item-grid',
'dataProvider'=>$items->search(),
'filter'=>$items,
'columns'=>array(
...
array(
'header'=>'',
'type'=>'raw',
'value'=>'(!($data->rate("'.$date.'")["test"] == 0)) ? CHtml::Button("+",
array("name" => "send_item",
"id" => "send_item",
"onClick" => "$(\"#item_dialog\").dialog(\"close\"); $(\"#item_id\").val(\"$data->id\");
$(\"#Items_description\").val(\"$data->description\");
$(\"#Items_unit_price\").val(\"$data->id\");"
)
)
: ""',
),
Fails with error: Property "Item.rate" is not defined.
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'item-grid',
'dataProvider'=>$items->search(),
'filter'=>$items,
'columns'=>array(
...
array(
'header'=>'',
'type'=>'raw',
'value'=>'(!($data->rate("'.$date.'")["test"] == 0)) ? CHtml::Button("+",
array("name" => "send_item",
"id" => "send_item",
"onClick" => "$(\"#item_dialog\").dialog(\"close\"); $(\"#item_id\").val(\"$data->id\");
$(\"#Items_description\").val(\"$data->description\");
$(\"#Items_unit_price\").val(\"$data->rate(\"'.$date.'\")[\"test\"]\");"
)
)
: ""',
),
Any idea how I can use $data->rate($date)["test"] in this onclick?