i have in my admin view and order button column i made using the following code:
'order'=>array(
'label'=>'Order', //Text label of the button.
'url'=>'$data->id', //A PHP expression for generating the URL of the button.
'imageUrl'=>Yii::app()->request->baseUrl.'/images/to_cart.jpg', //Image URL of the button.
'options'=>array('title'=>'Add to cart','class'=>'toCart','id'=>'$data->id'), //HTML options for the button tag.
//'click'=>'alert("clicked to order");', //A JS function to be invoked when the button is clicked.
'visible'=>'Yii::app()->user->checkAccess("stock.order")', //A PHP expression for determining whether the button is visible.
),
The problem is that in the ‘options’ array ‘id’=>’$data->id’ is not being evaluated, it is just preinted as is, i.e the html produced thereof is … id=’$data->id’, i realised the problem might be in zii.widgets.grid.CButtonColumn on function ‘renderButton’. I added the following lines to make it work:
$options[‘id’]=isset($options[‘id’]) ? $this->evaluateExpression($options[‘id’],array(‘data’=>$data,‘row’=>$row)) : ‘’;
Correct me if im wrong because i would appreciate another way of doing this without changing core framework files.