Hi all,
I have a CGridView with following button -
....
'buttons' => array(
'view' => array(
'label' => 'view',
'url' => 'Yii::app()->controller->createUrl("view",array("id"=>$data->id))',
'options' => array(
'ajax' => array(
'type' => 'POST',
'url' => 'js:$(this).attr("href")',
'success' => 'js:function(data){$("#view-page").html(data);}',
),
),
),
'update' => array(
'label' => 'update',
'url' => 'Yii::app()->controller->createUrl("update",array("id"=>$data->id))',
'options' => array(
'ajax' => array(
'type' => 'POST',
'url' => 'js:$(this).attr("href")',
'success' => 'js:function(data){$("#view-page").html(data);}',
),
),
),
'delete' => array(
'url' => 'Yii::app()->controller->createUrl("delete",array("id"=>$data->id))',
'label' => 'delete',
'options' => array(
'ajax' => array(
'type' => 'POST',
'url' => 'js:$(this).attr("href")',
'success' => 'js:function(data){$("#view-page").html(data);}',
),
),
),
''''
This works fine. But I have to implement the same buttons in all the gridviews and I do not want to copy all the above code everywhere in all my views containing gridview.
Is there any global place where I can specify this?
I tried components/widgetFactory setting in conf/main.php without any luck.
Please help!
Thanks.