I am showing a CGridView for another related model in the view&id=n page. The necessary relationships are included in the model files, and everything works fine. The only thing is that the buttons in CButtonColumn are associated with the corresponding actions of the model whose page opens, and I want them to be associated with the actions of the corresponding model.
To explain what I mean, here is my code. In the view.php the Order model:
$dataProvider=new CActiveDataProvider('OrderContents', array( 'criteria'=>array( 'condition'=>'order_id='.$model->id, 'with'=>array('order'), ), 'pagination'=>array( 'pageSize'=>20, ), )); $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'orders-contents-grid', 'dataProvider'=>$dataProvider, 'columns'=>array( 'id', 'comp_name', 'quantity', 'comment', array( 'class'=>'CButtonColumn', ), ), ));
Thus, I want the buttons in CButtonColumn refer to the corresponding actions for the OrderContents model, and now they are associated with the actions of the Order model. Is there an easy way to achieve this? I checked the API for both CButtonColumn and CGridView to see if I could get inspiration there, but no luck.
source share