在CommitPopup上有条件刷新父页面 [英] Conditional Refresh of Parent Page on CommitPopup

查看:68
本文介绍了在CommitPopup上有条件刷新父页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在sharepoint webpart中打开一个模态弹出窗口。它有两个按钮,即Save和Cancel。

当用户点击Save按钮时,必须关闭模态弹出窗口并刷新父页面。但是当他点击取消按钮时,弹出窗口必须关闭,但不应刷新父页面。请帮我一个方法来做到这一点。我经历了很多网站但找不到任何答案。



谢谢,

Srivikas。

解决方案

这是在模态对话框中打开页面的代码。要在父页面中使用



 SP.UI.ModalDialog.showModalDialog({
url:url,
width: 800
dialogReturnValueCallback:function(dialogResult, value ){
if value == < span class =code-string> 1){
window.top.location = window.top.location // 这将刷新页面
}
}
});





这是在保存和取消按钮中使用的代码OnClientClick事件



javascript:SP.UI.ModalDialog。 commonModalDialogClose(1,'1');



javascript:SP.UI.ModalDialog.commonModalDialogClose(0,'0');



在这个例子中,我们将回调值发送给调用函数。

根据模态对话框的返回值,您可以指定要执行的操作在父页面上进行。





希望它能帮助!!



对于本答复的任何加钙回复。 :)


Hi everybody,
I am opening a modal popup in a sharepoint webpart. It has two buttons i.e. Save and Cancel.
When the user clicks on Save button, the modal popup has to be closed and the parent page should be refreshed. But when he clicks on Cancel button, the popup has to be close but the parent page should not be refreshed. Please help me with a way to do this. I have gone through many sites but could not find any answer.

Thanks,
Srivikas.

解决方案

This is the code to open your page in modal dialog. To be used in the parent page

SP.UI.ModalDialog.showModalDialog({
            url: url,
            width: 800,
            dialogReturnValueCallback: function (dialogResult, value) {
                if (value == "1") {
                    window.top.location=window.top.location //this will refreshes the page
                }
            }
        });



This is the code to be used in the "Save" and "Cancel" buttons OnClientClick event

javascript:SP.UI.ModalDialog.commonModalDialogClose(1, '1');

javascript:SP.UI.ModalDialog.commonModalDialogClose(0, '0');

In this example we are sending the callback value to the calling function.
Based on the return value from modal dialog you can specify the action to be performed on the parent page.


Hope it Helps !!

For any calrification reply to this Answer. :)


这篇关于在CommitPopup上有条件刷新父页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆