I am using YiiBooster extension in yii.
I have created a form using 'booster.widgets.TbActiveForm', it works like a charm Now I just want to submit my form with ajax and update a grid
let's consider that
- my form id = myform
- my grid id = mygrid
I have the following code for the submit button in the form
$this->widget(
'booster.widgets.TbButton',
array(
'context' => 'primary',
'label' => 'Add',
'buttonType' => 'ajaxSubmit',
'url' => Yii::app()->createUrl('myController/myAction',array('id'=>$model->deal_id)),
'ajaxOptions' => array(
'type' => 'POST'
)
)
);
the AJAX works like a charm, but where do I put the grid update code after the ajax call is returned to the client side?
$.fn.yiiGridView.update('mygrid');
I also check the TbButton api documentation but I could not find a solution.
My last resort would be to hook a jQuery click function with my submit button and make the AJAX call myself, but I am hoping for a better solution.