PDA

View Full Version : Ext.TabPanel beforetabchange event



breckster
1 May 2013, 12:01 PM
I need to perform a Ajax call during this event in order to validate data. I need a way of delaying while the results of the ajax request are returned. So if needed I can return false thus maintaining the focus on the current tab. I have tried suspend and resume without much luck. I'm not looking for code just ideas.

willigogs
1 May 2013, 1:46 PM
One possibility:

Use a flag (such as valid=false). If flag = false, return false to cancel tab change and perform your Ajax call. On success set the flag to true, and fire the method to change your tab again (flag is now true, therefore Ajax call will not be performed, and the tab will successfully change). Finally, reset your flag back to false :)

breckster
3 May 2013, 12:19 PM
One possibility:

Use a flag (such as valid=false). If flag = false, return false to cancel tab change and perform your Ajax call. On success set the flag to true, and fire the method to change your tab again (flag is now true, therefore Ajax call will not be performed, and the tab will successfully change). Finally, reset your flag back to false :)

Thanks for the idea ... but I have multiple Ajax calls .. and sequencing them became a pain.
I decided to use async: false

Thanks for the reply.