View Full Version : Need TaskMgr.stopAll() to run on tab loose focus

28 Nov 2010, 7:58 PM
I have a groupTabpanel called Main and within Main I have two tabs, one called SubGroup1 and the other called subGroup2. SubGroup1 has a grid within it, and SubGroup2 has another tabpanel within it - with 2 tabs - one called 'myTasks' and one called 'myList',

I want to run a task service that will run ONLY on the 'myTasks' tab within SubGroup2, when the 'myTasks' tab is clicked or when the 'myTasks' tab is active, OR when it is viewable within my grouptabpanel. If SubGroup2 has lost focus, (like if we click on another tab, or click to open a new browser window) I want the task running in the 'myTasks 'tab to stop. If the tab gains focus again, (such as if we return to the open 'myTasks' tab) I want the task to run again. So... I want the task to run ONLY when the 'myTasks' tab is viewable or active. I am using Ext.TaskMgr to handle this, and I can get the task to run and stop using 'activate' and 'deactivate' but if I move away from the open 'myTasks' tab I am not able figure out how to stop the task from running. I looked at the API for tabpanel and I do not see anything other than 'activate', or 'deactivate' as a direct action to perform the call to Ext.TaskMgr.stopAll(). How do I call Ext.TaskMgr.stopAll() when the 'myTasks' tab looses focus, and call Ext.TaskMgr.start(task) when the 'myTasks' tab gains focus again?