我在我的 Web 应用程序中使用 YUI DataTable。当我的 DataTable 正在获取数据时,如果我关闭它并转到其他 DataTable,我会不断收到消息“停止运行此脚本?” 确认消息。我想避免此消息,并且我想在关闭 DataTable 后立即停止脚本运行。请提出您的建议。如果您需要更多信息,请告诉我。我正在从 JavaScript 进行 Web 服务调用以填充 DataTable。我怀疑这是导致提示的原因。我需要一种方法来阻止脚本执行 web 服务调用
显示数据表: ShowDialog(DisambigPanel, ReturnElement) document.getElementById("DisambigList").focus();
DisambigDataSource = new YAHOO.util.DataSource(DisData[CurDisType].URL);
DisambigDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
DisambigDataSource.responseSchema = {resultNode: DisData[CurDisType].Node, fields: DisData[CurDisType].Fields};
var TableConfig =
{
sortedBy: {key:DisData[CurDisType].SortKey, dir:"asc"},
selectionMode: "single",
initialRequest: BuildRequestString(),
scrollable: true,
width: "940px",
height: "340px",
renderLoopSize: 20
};
YAHOO.widget.DataTable.MSG_LOADING = "<img src=\"/Images/Wait/DataGrid.gif\" alt=\"Loading animation\"/> Loading...";
YAHOO.widget.DataTable.MSG_EMPTY = "No results.";
DisambigTable = new YAHOO.widget.DataTable("DisambigList", DisData[CurDisType].ColumnHeaders, DisambigDataSource, TableConfig);
YAHOO.util.Event.removeListener("DisambigList", "keydown");
YAHOO.util.Event.addListener("DisambigList","keydown",DisambigKeyDown);
DisambigTable.subscribe("initEvent",DisambigLoad);
DisambigTable.subscribe("cellDblclickEvent",DisambigSelect);
DisambigTable.subscribe("rowSelectEvent",DisambigSelectionChange)
函数 ShowDialog(dialog,returnFocus) { OldFocus = returnFocus; VisibleDialog = 对话框;
dialog.show()
var x = new YAHOO.util.KeyListener(document, { keys:27 }, { fn: HideDialog, scope:dialog, correctScope:true } );
x.enable();
dialog.cfg.queueProperty("keylisteners", x);
}
function HideDialog() {
// 隐藏当前对话框,如果可见 if (VisibleDialog) { // 隐藏当前对话框 VisibleDialog.hide(); 可见对话框=空;}
if (OldFocus)
{
OldFocus.focus();
OldFocus = null;
}
}