Extjs 5 - 整个页面上的LoadMask无法正常工作

时间:2014-06-18 23:02:35

标签: javascript extjs extjs5

在Extjs 4.2中,我在整个页面使用了Load Mask

在一个常见的实用程序类中:

loadMask: null,
showLoading : function() {
    if (!this.loadMask) {
      this.loadMask = new Ext.LoadMask(Ext.getBody(), { msg: "Loading..." });
    }
    this.loadMask.show();
  },

  clearLoading:function() {
    this.loadMask.hide();
  },

我在加载/保存期间在所有页面中调用此方法(等待服务器端响应),但在Extjs 5.0中,它无法正常工作,我收到以下错误消息:

Uncaught TypeError: Cannot call method 'mask' of undefined all-classes.js:1
Ext.define.show all-classes.js:1
Ext.define.loadingProcess all-classes.js:1
Ext.define.listeners.beforeload all-classes.js:1
Ext.define.doFire all-classes.js:1
Ext.define.fire all-classes.js:1
Ext.define.doDispatchEvent all-classes.js:1
Ext.define.dispatchEvent all-classes.js:1
Ext.define.doFireEvent all-classes.js:1
a.doFireEvent all-classes.js:1
Ext.define.fireEvent all-classes.js:1
Ext.define.load

1 个答案:

答案 0 :(得分:11)

得到了!!!它在Extjs 5.0中更改,Ext.getBody()返回Ext.dom.Element,而Element使用mask()和unmask(),所以它应该是

  //mask
 Ext.getBody().mask("Loading...");

//unmask
 Ext.getBody().unmask();