PDA

View Full Version : Is there a better way to hide the mask?



bseddon
15 Feb 2012, 10:05 AM
I noticed that when the Direct provider's 'beforecall' event return false after a store's load method is called then the mask is never removed.

Putting the following code in the body of the beforecall event makes sure the mask is hidden


onBeforeCall: function(provider,transaction,method) {
var result = false;
callback = transaction.callback;
callback({}, {}, result );
return result;
}

Executing the load callback hides the mask because causes runs the 'processResponse' method of the proxy to run. It seems a bit indirect. Is there a way to obtain a reference to the loadmask more directly so the 'hide' function can be called?

You might reasonably ask why return false from 'beforecall' when false can be returned from 'beforeload' which is called before the mask is displayed. The answer is defensive programming. I'd put code in the 'beforecall' event body to check parameters for Direct API methods other than the 'read' method but never saw data loaded because the code returned false. The right thing to do is return false only in the correct circumstances but I know I'll screw up and would like the mask to disappear when I do.

mitchellsimoens
15 Feb 2012, 10:50 AM
What version are you seeing this with? Have you tried with 4.1.0?

bseddon
15 Feb 2012, 12:01 PM
Ah, yes, I *only* tried it in 4.1 beta 2 (and last night's build). I did go back to 4.0.7 where the problem does *not* occur. However 4.0.7 has a related problem I'm trying to escape from (http://www.sencha.com/forum/showthread.php?171413-Grid-panel-loadmask-is-not-removed-when-Remoting-exception-occurs)

Should I post this in the 4.1 forum or are you able to move it there?