1. #1
    Ext User heidtmare's Avatar
    Join Date
    Mar 2007
    Location
    The Space Coast, FL
    Posts
    307
    Vote Rating
    0
    heidtmare is on a distinguished road

      0  

    Default loading event question

    loading event question


    What event do i need to monitor so i know when my content has loaded and can begin dissecting it?

    PHP Code:
    var west = new Ext.ContentPanel'search',  {autoCreatetrueurl: {url'./includes/search.panel',  loadOnce:truescripts:true}, fitToFrametrueautoScrolltrue} )
    layout_root.beginUpdate();
    layout_root.add('west',  west);
    layout_root.endUpdate();
                
    //Event handlers
    Ext.get('submit_search').on('click'this.createResultPanelthistrue); //<-- 'submit_search' is in search.panel 
    I like it. Simple, easy to remember.
    ...but why is the rum gone?

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    It doesn't look like you can pass a callback thru the CP config, but you should be able to add a handler to the update event of the UpdateManager for the CP's Element.

  3. #3
    Ext User heidtmare's Avatar
    Join Date
    Mar 2007
    Location
    The Space Coast, FL
    Posts
    307
    Vote Rating
    0
    heidtmare is on a distinguished road

      0  

    Default


    i tried this:
    PHP Code:
                var wUM west.getUpdateManager();
                
    wUM.on('update', function(){
                    
    Ext.get('submit_search').on('click'this.createResultPanelthistrue);
                }) 
    didnt work.
    I like it. Simple, easy to remember.
    ...but why is the rum gone?

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    Didn't work b/c the handler didn't fire or b/c the submit_search element isn't there yet?

  5. #5
    Ext User heidtmare's Avatar
    Join Date
    Mar 2007
    Location
    The Space Coast, FL
    Posts
    307
    Vote Rating
    0
    heidtmare is on a distinguished road

      0  

    Default


    i get a fn has no properties error on the event manager
    I like it. Simple, easy to remember.
    ...but why is the rum gone?

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    That might be because the scope in which this code is executed is wrong, and "this.createResultPanel" is not the function you have in mind. Stop in the code.

    Code:
    var wUM = west.getUpdateManager();
                wUM.on('update', function(){
                    Ext.get('submit_search').on('click', this.createResultPanel, this, true);
                })
    But the main problem is that Element.update() returns immediately unless it was called with loadScripts true.

    So to enable code to add handlers to loaded content, the UpdateManager has to have loadScripts true:

    Code:
        var wUM = west.getUpdateManager();
        wUM.loadScripts = true;
        wUM.on('update', function(){
            Ext.get('submit_search').on('click', this.createResultPanel, this, true); //<-- ensure this.createResultPanel exists.
        })

Thread Participants: 2