YUI DataTable - 如何避免“停止运行此脚本?”确认消息

时间:2009-10-01 04:21:44

标签: javascript yui-datatable

我在我的网络应用程序中使用YUI DataTable。虽然我的DataTable正在获取数据,如果我关闭它并转移到其他DataTable我继续收到消息'停止运行此脚本?'确认消息。我想避免这个消息,我想在关闭DataTable后立即停止脚本运行。请提出你的建议。如果您需要更多信息,请告诉我。 我正在从JavaScript进行webservice调用以填充DataTable。我怀疑这是导致提示。我需要一种方法来阻止脚本执行webservice调用

显示DataTable:     ShowDialog(DisambigPanel,ReturnElement)     的document.getElementById( “DisambigList”)聚焦();

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.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();         VisibleDialog = null;     }

if (OldFocus)
{
    OldFocus.focus();
    OldFocus = null;
}

}

1 个答案:

答案 0 :(得分:1)

嗯,据我所知,如果脚本花费太多时间或者处于无限循环中,FireFox会显示这种提示。尝试检查它是否可以在除您正在使用的浏览器之外的其他浏览器中运行...