PDA

View Full Version : Extjs Button Clicked Multiple Times



manishnp
3 Jul 2013, 3:44 AM
Hi ,
I found one solution for the problem which I am facing , but it was for Sencha Touch.You can follow the link

http://stackoverflow.com/questions/11522736/sencha-touch-clicking-a-button-rapidly-will-push-a-view-twice (http://stackoverflow.com/questions/11522736/sencha-touch-clicking-a-button-rapidly-will-push-a-view-twice)

What I need now how I can prevent a button which if gets clicked multiple times executes the code and then there is a mess.

On my button click I am loading a View and Showing it to a Center Region panel.When I click the Button multiple times(i.e keep on clicking the button ) it just make the screen blank.

I want to prevent this multiple clicks.


Thanks
Manish Pandit


(http://stackoverflow.com/questions/11522736/sencha-touch-clicking-a-button-rapidly-will-push-a-view-twice)

Johnny Major
3 Jul 2013, 6:18 AM
When the button is clicked you could first mask the screen then proceed.

slemmon
4 Jul 2013, 2:06 PM
I think I'd disable (or mask) the button add a listener to the store's load event to enable (unmask) it.



handler: function (btn) {
var store = view.getStore();


store.on({
load: function () {
btn.enable();
},
single: true
});


btn.disable();
store.load();
}


If the view's store and this load button are stable fixtures you could even just add a beforeload and load listener to the store to disable / mask the button and then enable it on load and the button handler would just have the view.getStore().load() action.