My tabpanel based app is nearly finished, but I'd like to improve it by adding a global loadmask that appears on each tap of my tabpanel, and disappears after the contents of the particular tab has been rendered.
I am a little unclear though what I should be listening for, should I activate the loadmask on activeitemchange, then unmask it using a global painted event? I'm assuming the most efficient way of doing this would be in my main controller, as then I'd only have to do it once instead of having multiple listeners (like in the only examples I have found). This seems to work and I get a loadmask on clicking a tab item, but I'm not sure how to unmask on the painted event:
Ext.define('TCApp.controller.Main', {
extend: 'Ext.app.Controller',
config: {
refs: {
tabpanel: 'tabpanel'
},
control: {
tabpanel: {
activeitemchange: 'onActiveItemChange'
}
}
},
onActiveItemChange: function (self, newItem) {
Ext.Viewport.setMasked({ xtype: 'loadmask', message: 'Loading...', indicator:true});
console.log('Activeitemchanged');
}
});
Is this the best way, putting the Ext.Viewport.setMasked(false);
on the painted event, in the main controller? I'm not really sure how to do this.
I've also been reading this, but I don't think it helps much: