Results 1 to 6 of 6

Thread: Registering and Invoking onAvailable function

  1. #1
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    55

    Default Registering and Invoking onAvailable function

    In extjs 3.4, I have used following to register function. Here, id is field' unique id.

    Code:
    Ext.lib.Event.onAvailable(id,
         function(page) {
               page.showMyTableState(dataAvailable);
         },
         this
    );
    What is the alternate of "Ext.lib.Event.onAvailable" in Extjs 4.1

    I tried below, but does not help.

    Ext.AbstractManager.onAvailable(id,


    Thanks.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    You souldn't use the AbstractManager, you should use a subclass like the ComponentManager
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    55

    Default

    Can you please provide me any examples. If I register a function using below method, It never invoke [showMyTableState] method.

    Code:
    Ext.ComponentMgr.onAvailable(id, 
                function(page) {
                        page.showMyTableState(recProgData.DAYSOFWEEK);
                },
                this
        );

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    Then it means your component never becomes available. Here's a trivial test case:

    Code:
    Ext.require('*');
    
    Ext.onReady(function() {
    
        new Ext.Component({
            id: 'a'
        });
        
        Ext.ComponentManager.onAvailable('a', function() {
            console.log('already loaded, fire straight away');
        });
        
        
        Ext.ComponentManager.onAvailable('b', function() {
            console.log('not loaded, fire when ready');
        });
        
        new Ext.Component({
            id: 'b'
        });
    
    });
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    55

    Default

    Thanks, I understand.
    Can I attach onAvailable event on table, as below??
    It does not invoke the method, Is that because I am registering method to HTML table tag and not to panel??

    Code:
        var id = Ext.id();
        var HTML = "<table id=" + id+ " class=\"t-grid-inline-days\"><tbody><tr>";    
        var td = "<td class=\"t-grid-day-off";        
        HTML = HTML + td + "\">" + this.it.myName[0].substring(0,2) + "</td>";        
        HTML = HTML + td + "\">" + this.it.myName[1].substring(0,2) + "</td>";        
        HTML = HTML + "<\/tr></tbody><\/table>";
       
        Ext.AbstractManager.onAvailable(id,
                function(page) {
                        page.showMyTableState(recProgData.DAYSOFWEEK);
                },
                this
        );
    Thanks.

  6. #6
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    No, you can't. There's nothing that tracks when the HTML state of the page changes. You'd need to call whatever function after you create it.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Tags for this Thread

Posting Permissions

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