开发者

MVC Partial Views - Qtip

I'm working with MVC's views

I have a main view which contains a partial view. My partial view is rendered with the actions that are fired from the elements that it contains. I also have a jquery of tooltips from "Qtip". Everything works fine.

My problem is that everytime I render the partial view, the complete functionality of the jquery is lost and my tooltips don't work.

T开发者_如何学运维hanks


This behaviour is expected because the new elements created when rendering the partial view do not have any javascript/jQuery properties/functions/etc. You will have to re-add these jQuery tooltips after the partial view is rendered.

You can do this by adding an "OnSuccess" option to the MVCAjax form, e.g.,

<% using (Ajax.BeginForm("Index", new AjaxOptions
    {
       LoadingElementId = "loading",
       OnSuccess = "functionCall",
       UpdateTargetId = "list-current"
    }))
    { %>

You then need the javascript

function functionCall(result) {
    // re-attach jquery to objects
    // and/or do anything with return value "result"
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜