YUI DataTable - 如何避免“停止运行此脚本?”确认消息
我在我的网络应用程序中使用 YUI DataTable。当我的数据表正在获取数据时,如果我关闭该数据表并转到其他数据表,我会不断收到消息“停止运行此脚本?”确认消息。我想避免出现此消息,并且希望在关闭数据表后立即停止脚本运行。请提出您的建议。如果您需要更多信息,请告诉我。 我正在从 JavaScript 进行 Web 服务调用来填充 DataTable。我怀疑这就是导致提示的原因。我需要一种方法来阻止脚本执行 Web 服务调用
显示数据表: 显示对话框(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.show()
var x = new YAHOO.util.KeyListener(document, { keys:27 }, { fn: HideDialog, scope:dialog, correctScope:true } );
x.enable();
dialog.cfg.queueProperty("keylisteners", x);
函数
隐藏对话框() {
// 隐藏当前对话框(如果可见) 如果(可见对话框) { // 隐藏当前对话框 VisibleDialog.hide(); 可见对话框 = null; }
if (OldFocus)
{
OldFocus.focus();
OldFocus = null;
}
}
I am using YUI DataTable in my web application. While my DataTable is fetching the data if I close that and move on to other DataTable I keep getting the message 'Stop running this Script?' confirm message. I want to avoid this message and I want to stop the script from running as soon as I close the DataTable. Please give your suggestions. Please let me know if you need more info.
I am making a webservice call from JavaScript to populate DataTable. I suspect that is causing the prompt. I would require a way to stop script from executing webservice call
Showing DataTable:
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)
function ShowDialog(dialog,returnFocus)
{
OldFocus = returnFocus;
VisibleDialog = dialog;
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()
{
// Hide the current dialog, if one is visible
if (VisibleDialog)
{
// Hide the current dialog
VisibleDialog.hide();
VisibleDialog = null;
}
if (OldFocus)
{
OldFocus.focus();
OldFocus = null;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,据我记得,如果脚本花费太多时间或处于无限循环中,FireFox 会显示这种提示。尝试检查它是否可以在您正在使用的浏览器之外的其他浏览器中运行...
Well, as far as I remember, that kind of a prompt is shown by FireFox if the script is taking too much time, or is in an infinite loop. Try checking whether it works in another browser apart from the one you're using...