0

In my sencha touch app whenever I call an Ajax request I set a loading mask on the screen until some response is sent back but lets say I have more than one Ajax request executing at the same time, I see multiple loading masks. How do I stop this from happening. I tried to put a check like

if(Ext.Viewport.getMasked()){
//bypass
}
else {
Ext.Viewport.setMasked({
                xtype: 'loadmask'
            });
}

But this not seem to work and when request is completed I do this

Ext.Viewport.unmask();

But my problem is that I see two masks if e.g. two requests are running parallely. Is there is a way to prevent this from happening.

I am using Sencha touch 2.3.0

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Nick Div
  • 5,338
  • 12
  • 65
  • 127

1 Answers1

0

Your problem might be that you are doing Ext.Viewport.getMasked instead of Ext.Viewport.getMasked(). Regardless, if you are setting multiple loadmasks on the same component (in this case, Viewport) the new one will replace the older. Most likely you are setting these masks on different components, which is why you are seeing more than one.

Here is a link to a Sencha Fiddle showing how Viewport loadmasks replace. If you are still having issues, please share some code.

OhmzTech
  • 897
  • 1
  • 5
  • 7
  • I am actually doing getMasked() and no I am always setting the mask on the Viewport but I see multiple masks – Nick Div Aug 14 '14 at 23:43
  • Can you provide more complete code? The example I provided on the Fiddle is pretty straightforward, so you must have something custom going on here. – OhmzTech Aug 14 '14 at 23:48