Results 1 to 2 of 2

Thread: Using TaskMgr in component extension

  1. #1
    Ext User
    Join Date
    Apr 2008
    Location
    Rotterdam, The Netherlands
    Posts
    17

    Default Using TaskMgr in component extension

    I'm trying to make a status bar component by extending Ext.Panel. All works well except for the clock. Apparently TaskMgr runs in a different scope and so the default clock function doesn't work.

    My code:
    Code:
    Dasensys.IntraPortal.StatusBar = Ext.extend(Ext.Panel, {
        border: false
        
        ,initComponent:function() {
            this.db_status   = new Ext.Toolbar.TextItem('DB: elmarc_epp_devel');
        this.user_status = new Ext.Toolbar.TextItem('Username: Guest');
        this.clock       = new Ext.Toolbar.TextItem('');
    
            Ext.apply(this, {
                 height: 0
          ,bbar: new Ext.StatusBar({
             text: 'Ready'
            ,iconCls: 'ready-icon'
            ,items: [this.user_status, ' ', this.db_status, ' ', this.clock, ' ']
          })
            });
            
            Dasensys.IntraPortal.StatusBar.superclass.initComponent.apply(this, arguments);
            
            this.on({
                 scope: this
                ,render: function() {
                    Ext.fly(this.db_status.getEl().parentNode).addClass('x-status-text-panel');
                    Ext.fly(this.user_status.getEl().parentNode).addClass('x-status-text-panel');
            Ext.fly(this.clock.getEl().parentNode).addClass('x-status-text-panel');
    
                    Ext.TaskMgr.start({
                run: function(){
                  Ext.fly(this.clock.getEl()).update(new Date().format('g:i:s A'));
                },
                interval: 1000
              });
                }
            })
        }
        
        ,onRender:function() {
            Dasensys.IntraPortal.StatusBar.superclass.onRender.apply(this, arguments);
        }
    })
    This leaves me with two options:
    A: Give clock an id and update the clock by using Ext.getCmp(id). Although this should work and won't give problems using this example (there is only one status bar anyway), it isn't very portable.
    B: Substitute this.clock.getEl() with the auto assigned value before passing the function to the TaskMgr. Although I believe this is the way to go, I made several attempts to do so without any results (except for lots of errors).

    Any suggestions for a workable B solution?

  2. #2
    Ext User
    Join Date
    Apr 2008
    Location
    Rotterdam, The Netherlands
    Posts
    17

    Default

    Does anyone has an idea how to solve this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •