开发者

Can I refresh a Yii CGridView from js?

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.


Execute $.fn.yiiGridView.update("<id of CGridView>");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜