[CLOSED] TaskMgr fails to stop the tasks

  1. #1

    [CLOSED] TaskMgr fails to stop the tasks

    Hi,

    Please refer to the example at http://examples1.ext.net/#/TaskManager/Basic/Overview/.
    The Ext.TaskMgr.stopAll(); statement fails to stop the tasks on the page if called from within the btnStopAll click handler:

    <ext:Button ID="btnStopAll" runat="server" Text="Stop All Tasks" Icon="ControlStopBlue">
           <Listeners>
                  <Click Handler="this.disable(); /*#{TaskManager1}.stopAll();*/ Ext.TaskMgr.stopAll(); #{btnStartAll}.enable();" />
           </Listeners>
    </ext:Button>
    Last edited by fabricio.murta; Apr 22, 2016 at 2:13 PM. Reason: [CLOSED]
  2. #2
    By request, thread moved from Community - 1.x Help to Premium - 1.x Premium Help.

    Effective as of the date of the posting of this message.

    We'll be providing feedback on your request in the following messages!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello Vadym!

    The Ext.TaskMgr class pertains to ExtJS only. It can only handle tasks created and stopped by its own instance.

    Ext.NET implements its own task manager which Ext.TaskMgr does not know about. In the examples TaskManager1 is an instance of Ext.net.TaskManager.

    Aside of that, Ext.TaskMgr is a class with the static methods to start, stop and stop all tasks. It does not support, for example, stopping and resuming a task. You start a task specifying it. So you won't see a method to start all tasks there.

    In Ext.net.TaskManager implementation, you can, for example get a list of all running tasks and individually stop or resume then.

    On the example you pointed, you see usage and features of Ext.net.TaskManager. You can get more info on the ExtJS-specific feature on its documentation page. It should work on Ext.NET 1 -- from JavaScript side.

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Thanks for your reply, Fabricio!

    Is there any utility method to enumerate all TaskManager instances on the page on the client side? Something like below (doesn't work):

                Ext.ComponentMgr.all.each(function (c) {
                    if (c instanceof Ext.net.TaskManager) {
                        c.stopAll();
                    }
                 });
  5. #5
    Hello Vadym!

    This would work for Ext.NET 1:
    // list of all variables in global space (that's how Ext.NET 1 registers components with ID)
    var varList = Object.keys(window);
    for (var i in varList) {
        if (eval(varList[i]) instanceof Ext.net.TaskManager) {
            console.log(varList[i]) // I think you'll want here to 'eval(varList[i]).stopAll()'
        }
    }
    As you can see, this is [i]a little overkill[/var] as it steps thru every variable in global space. In the Ext.NET example, it can be around 40-50 variables to test against.

    For Ext.NET 2 and beyond though, this won't work, but you would have to specify instead of window, the namespace you assigned to Ext.NET's Resource Manager. If nothing has been specified, the name is App, so you'd just use Object.keys(App) and get a list of only the components you gave an explicit ID on the page (or code behind) during creation. A much smaller and objective list. :)

    Of course, there might be another handful of options of getting this, maybe much better performatic. That's just the way I could think first when you asked. And it is one that just works.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  6. #6
    Thanks again for the pointers! Please feel free to close this thread.

Similar Threads

  1. [CLOSED] Simple Tasks - example explaination
    By echodev in forum 2.x Premium Help
    Replies: 6
    Last Post: Feb 15, 2013, 4:10 AM
  2. [CLOSED] Simple Tasks sample not working
    By bogc in forum 1.x Premium Help
    Replies: 4
    Last Post: May 31, 2012, 12:40 PM
  3. [CLOSED] Tasks stop running after store.save() is called
    By peter.campbell in forum 1.x Premium Help
    Replies: 7
    Last Post: Oct 11, 2011, 9:06 AM
  4. [CLOSED] Reminder in Simple Tasks
    By speedstepmem3 in forum 1.x Premium Help
    Replies: 2
    Last Post: Jul 15, 2011, 10:42 AM
  5. Page Async Tasks
    By anand in forum 1.x Help
    Replies: 2
    Last Post: Jun 05, 2009, 2:28 PM

Tags for this Thread

Posting Permissions