Can I refresh a Yii CGridView from js?
Posted
by Brian Dunn
on Stack Overflow
See other posts from Stack Overflow
or by Brian Dunn
Published on 2010-06-17T22:39:37Z
Indexed on
2010/06/17
22:43 UTC
Read the original article
Hit count: 455
When a "Create" modal dialog is submitted via XHR Then the rows in a Yii CGridView should be refreshed.
I've tried to achieve this by rendering the new gridview in the XHR "create" action and then inserting it into the page via $("#list").html(response)
, but rendering a CGridView
causes jQuery <script>
include tags to be registered for inclusion, and so when I introduce those tags into the page they reload jQuery, which wipes out my live event handlers, so a bunch of stuff breaks.
Which has me thinking, "the GridView knows how to refresh itself. heck, it does all the time on sort or page."
So I can click a sort button in the GridView from js, but thats less than Ideal. I'd prefer to say
$("#list").gridview('reload') or $.fn.gridview.reload("#list") or some such sense.
Or do the way cool thing that is soo much simpler that you thought of just now.
© Stack Overflow or respective owner