javascript Extjs 加载掩码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27552218/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 07:37:31  来源:igfitidea点击:

Extjs Load Mask

javascriptextjsextjs4extjs4.2loadmask

提问by orangeMint

I have a grid that when clicked takes a few seconds to pull up my pop-up window. I would like to have a 'loading...' message displayed while the pop-up window is loading. This is what I have so far:

我有一个网格,点击它需要几秒钟才能拉出我的弹出窗口。我希望在加载弹出窗口时显示“正在加载...”消息。这是我到目前为止:

    onCellClick : function(view, td, eOpts ) {
    var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
    myMask.show();
    Ext.create('myapp.view.DetailWindow', {
        title : 'my title',
        width : 900,
        approachRec : record
    });
    myMask.hide();

}

Right now this works perfectly, once I click on a cell in the grid my loading box appears then goes away once my 'DetailWindow' comes up.

现在这很完美,一旦我点击网格中的一个单元格,我的加载框就会出现,一旦我的“DetailWindow”出现,它就会消失。

However, once I close my window and click on another cell (or the same one) again. No loading box appears, but my 'detail' window does. What am I doing wrong?

但是,一旦我关闭窗口并再次单击另一个单元格(或同一个单元格)。没有出现加载框,但我的“详细信息”窗口会出现。我究竟做错了什么?

What do I need to do in order to have my loading box pop up every time I click on cell?

我需要做什么才能在每次单击单元格时弹出加载框?

I'm using Extjs 4.2

我正在使用 Extjs 4.2

Thanks,

谢谢,

采纳答案by Dexygen

The code you've posted does not show() the window, it just creates it. Below is some code that I've developed that "works" (I used a setTimeout to show the window after a 3 second delay, and then to hide the loading mask), but I think that to get to the heart of your problem, you are going to have to use your debugger, and see if it is displaying any errors in the console.

您发布的代码不会显示()窗口,它只是创建它。下面是我开发的一些“有效”的代码(我使用 setTimeout 在 3 秒延迟后显示窗口,然后隐藏加载掩码),但我认为这是解决问题的核心,您将不得不使用调试器,并查看它是否在控制台中显示任何错误。

grid.on('cellclick', function() {
    var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
    myMask.show();
    var window = Ext.create('Ext.window.Window', {
        title: 'Hello',
        height: 200,
        width: 400
    });
    setTimeout(function() {
        window.show();
        myMask.hide();
    }, 3000);
});