防止在模块选择 DNN 9 时重新加载页面
Prevent Page Reload on Module Selection DNN 9
当我在模块选择对话框中单击一个模块时,DNN 会刷新页面(在悬停之前,可拖动元素出现在页面上)。这只会在使用我们的皮肤时发生 (https://github.com/2sic/dnn-theme-bootstrap3-instant)。
DNN 正在使用 Teleriks findComponent
方法寻找元素 #dnn_ContentPane_SyncPanel
(这似乎是一个 ajax 包装器)。由于找不到该元素,DNN 执行页面重新加载。
我们的皮肤内容面板:
<div id="ContentPane" runat="server" containertype="G" containername="Invisible Container" containersrc="default.ascx"></div>
触发重新加载的 DNN 代码(最后一个函数调用):
refreshPane: function (paneName, args, callback, callOnReload) {
var paneId;
if (!paneName) {
paneId = this.getModuleManager().getPane().attr('id');
} else {
paneId = this.getPaneById(paneName).attr('id');
}
var pane = $('#' + paneId);
var parentPane = pane.data('parentpane');
if (parentPane) {
this.refreshPane(parentPane, args, callback);
return;
}
//set module manager to current refresh pane.
this._moduleManager = pane.data('dnnModuleManager');
var ajaxPanel = $find(paneId + "_SyncPanel");
if (ajaxPanel) {
//remove action menus from DOM bbefore fresh pane.
var handler = this;
pane.find('div.DnnModule').each(function () {
var moduleId = handler._moduleManager._findModuleId($(this));
$('#moduleActions-' + moduleId).remove();
});
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._refreshCompleteHandler);
this._refreshPaneId = paneId;
this._refreshCallback = callback;
ajaxPanel.ajaxRequest(args);
} else {
//save the args into cookie, after page reload then catch the cookie
//and float the module for drag
if (args && !this._noFloat) {
this._setCookie('CEM_CallbackData', args);
}
if (callOnReload && typeof callback == "function") {
callback.call($('#' + paneId), [true]);
}
location.reload();
}
}
一段时间后,我们发现了问题所在。
我们的皮肤使用 <%=SkinPath%>
语法而不是 <%#SkinPath%>
,这导致 DNN 强制重新加载。这可能与文档的生命周期有关。
当我在模块选择对话框中单击一个模块时,DNN 会刷新页面(在悬停之前,可拖动元素出现在页面上)。这只会在使用我们的皮肤时发生 (https://github.com/2sic/dnn-theme-bootstrap3-instant)。
DNN 正在使用 Teleriks findComponent
方法寻找元素 #dnn_ContentPane_SyncPanel
(这似乎是一个 ajax 包装器)。由于找不到该元素,DNN 执行页面重新加载。
我们的皮肤内容面板:
<div id="ContentPane" runat="server" containertype="G" containername="Invisible Container" containersrc="default.ascx"></div>
触发重新加载的 DNN 代码(最后一个函数调用):
refreshPane: function (paneName, args, callback, callOnReload) {
var paneId;
if (!paneName) {
paneId = this.getModuleManager().getPane().attr('id');
} else {
paneId = this.getPaneById(paneName).attr('id');
}
var pane = $('#' + paneId);
var parentPane = pane.data('parentpane');
if (parentPane) {
this.refreshPane(parentPane, args, callback);
return;
}
//set module manager to current refresh pane.
this._moduleManager = pane.data('dnnModuleManager');
var ajaxPanel = $find(paneId + "_SyncPanel");
if (ajaxPanel) {
//remove action menus from DOM bbefore fresh pane.
var handler = this;
pane.find('div.DnnModule').each(function () {
var moduleId = handler._moduleManager._findModuleId($(this));
$('#moduleActions-' + moduleId).remove();
});
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._refreshCompleteHandler);
this._refreshPaneId = paneId;
this._refreshCallback = callback;
ajaxPanel.ajaxRequest(args);
} else {
//save the args into cookie, after page reload then catch the cookie
//and float the module for drag
if (args && !this._noFloat) {
this._setCookie('CEM_CallbackData', args);
}
if (callOnReload && typeof callback == "function") {
callback.call($('#' + paneId), [true]);
}
location.reload();
}
}
一段时间后,我们发现了问题所在。
我们的皮肤使用 <%=SkinPath%>
语法而不是 <%#SkinPath%>
,这导致 DNN 强制重新加载。这可能与文档的生命周期有关。