PDA

View Full Version : LoadMask crash



deister
25 Oct 2011, 9:08 AM
Ext.LoadMask crashes:


<SCRIPT TYPE='text/javascript'>
Ext.onReady( function() {
var mask = new Ext.LoadMask(Ext.getBody(),{msg:'hola'});
});


</SCRIPT>



with the following error:


Uncaught TypeError: Cannot read property 'isDetachedBody' of undefined
Ext.define.flushInvalidates ext-all-debug-w-comments.js:75182
Ext.define.run ext-all-debug-w-comments.js:75633
Ext.define.statics.flushLayouts ext-all-debug-w-comments.js:60170
Ext.define.statics.updateLayout ext-all-debug-w-comments.js:60208
Ext.define.updateLayout ext-all-debug-w-comments.js:62550
Ext.define.setSize ext-all-debug-w-comments.js:62491
Ext.define.initComponent ext-all-debug-w-comments.js:61122
callParent ext-all-debug-w-comments.js:4933
Ext.define.initComponent ext-all-debug-w-comments.js:77027
Ext.define.constructor ext-all-debug-w-comments.js:61080
callParent ext-all-debug-w-comments.js:4933
Ext.define.constructor ext-all-debug-w-comments.js:76986
constructor ext-all-debug-w-comments.js:5946
Ext.define.constructor ext-all-debug-w-comments.js:81460
constructor ext-all-debug-w-comments.js:5946
(anonymous function) index_test.html:18
isEvent ext-all-debug-w-comments.js:12414
fire ext-all-debug-w-comments.js:12556
Ext.EventManager.fireDocReady ext-all-debug-w-comments.js:12691

Baumi
25 Oct 2011, 10:31 PM
I have this same issue under 4.1 pr1. Before (4.0.7) that worked fine.

Pipster123
25 Oct 2011, 10:57 PM
Error in LoadMask constructor, when setting loadmask ownerCt in case desired masked element is Ext.getBody(). I tried fiddling around with overriden constructor but so far no luck.

locutusUT
2 Nov 2011, 11:33 AM
I am also experiencing the same condition.

S├ębastien.Volle
27 Dec 2011, 1:27 AM
The problem is still present in Ext JS 4.1 beta.

keithrust
23 Jan 2012, 10:13 AM
I'm using the latest nightly build, ext-4.1-20120122, and I'm seeing the issue still isn't fixed, but it's manifesting itself in a new location, ext-all-debug line 43354.


up: function(selector) {



var result = this.getBubbleTarget();
if (selector) {
for (; result; result = result.getBubbleTarget()) {
if (Ext.ComponentQuery.is(result, selector)) {
return result;
}
}
}
return result;
},



ext-all-debug.js:43354 (http://localhost:8080/ext-4.1-20120122/ext-all-debug.js)Uncaught TypeError: Object [object Object] has no method 'getBubbleTarget'

rspaeth
23 Jan 2012, 4:50 PM
the constructor for the loadMask in 4.1 beta no longer takes el as an argument. it is now component. there is a hint in the code that says:


'Ext.LoadMask: LoadMask for elements has been deprecated, use Ext.dom.Element.mask & Ext.dom.Element.unmask'



/**
* Creates new LoadMask.
* @param {Ext.Component} comp The Component you wish to mask. The the mask will be automatically sized
* upon Component resize, and the message box will be kept centered.</p>
* @param {Object} [config] The config object
*/
constructor : function(comp, config) {
var me = this;

//<debug>
if (!comp.isComponent) {
if (Ext.isDefined(Ext.global.console)) {
Ext.global.console.warn('Ext.LoadMask: LoadMask for elements has been deprecated, use Ext.dom.Element.mask & Ext.dom.Element.unmask');
}
comp = Ext.get(comp);
this.isElement = true;
}
//</debug>

me.ownerCt = comp;
//<debug>
if (!this.isElement) {
//</debug>
me.bindComponent(comp);
//<debug>
}
//</debug>
me.callParent([config]);

if (me.store) {
me.bindStore(me.store, true);
}
},

rspaeth
24 Jan 2012, 9:54 AM
try this instead:




Ext.onReady( function() {
Ext.getBody().mask( 'hola' );
});

keithrust
25 Jan 2012, 12:34 PM
Ah, that is sooo much better. Why in the world is this not documented in the Ext JS 4 docs? I'm looking forward to the full release and completed documentation.

gilfeather
25 Jan 2012, 1:57 PM
I'm looking forward to the day when the code is backwards compatible. Depracating in a point release, especially when the release is a performance release and not a functional release seems pointless. Deprecating without still functioning and giving a warning (compile time, run-time, debug mode only, whatever) is not really deprecating that is usually called a "breaking change".

Is it that you want the loadmask invocation code to be so fast that the check to see if the paramater is an element and making the new style call is too much overhead? If so, that is called "over optimization".

If it is because this is the "new" way to do things and you are trying to align the stars then "please stop" and realize that there are "over 1 million developers" using your product and that you are not enhancing their productivity.

If it just happened and you are not sure why consider, unit tests, code reviews, etc.