How To Refresh A Cgridview After New Entry In Db?

I have a page that adds, updates, and deletes people records. It is a two-pane (parent-child) page achieved by two column divs side by side.

In the left pane, I have a TBGridView (basically a CGridView with a bootstrap look) from the YiiBooster extension set. It lists all the people in the DB from the data provider. Each person is clickable, and on click their full information is brought up in the right pane. This is done via the selectionChanged attribute calling ‘updateChild’ in my controller, that finds the relevant person according to the primary key passed in from the AJAX request.

Also in the page is a "new" button, which brings up a blank form to enter a new set of details (in the right - child - view). Once the details are entered, the submit button has a JS listener on it, that AJAX calls the create action in my controller to submit the new person and return the details of such.

What I would also like to do is to refresh the grid view on a successful submission without needing to refresh the full page. In the success function of the AJAX submit request, I have tried:


$('yw0').yiiGridView('update');

and:


$.fn.yiiGridView.update('yw0',{});

Neither of these work, saying that the function isn’t defined.

I’ve searched but I can’t seem to find an adequate solution to this problem. Does anybody have any ideas? Thanks.

Try this it works.


JQuery('#task-grid').yiiGridView('update');