开发者

ExtJS AJAX TabPanel tab load event?

开发者 https://www.devze.com 2023-03-10 15:47 出处:网络
Is there any way to add an event listener to the load/update event of a ajax based tabpanel in ExtJS v3.3.1? I need an event that fires after the tab content is retrieved and fully rendered, not right

Is there any way to add an event listener to the load/update event of a ajax based tabpanel in ExtJS v3.3.1? I need an event that fires after the tab content is retrieved and fully rendered, not right after the tab is selected/activated and the loading spinner is displayed.

I thought I would be able to add this event on the Ext.Updater object returned by the tabpanel's getUpdater() method, i.e.:

myTabs.getUpdater().on('update', function()
{
    console.log('tab loaded');
});

But that does not seem to w开发者_C百科ork. Any ideas?

Edit: Here's my full implementation to make it easier to see what I'm trying to do:

var myTabs = new Ext.TabPanel( 
{ 
    id : 'rec_tabs', 
    activeTab : 0,    
    enableTabScroll : true, 
    padding : 5, 
    autoWidth : false, 
    autoHeight : true, 
    border : false, 
    plain : true, 
    defaults : { autoHeight: true }, 
    items : 
    [ 
        { title : 'Tab #1',  autoLoad : { url : 'tab1_content.php', scripts : true } }, 
        ... 
    ] 
}); 

myTabs.render('tab_div'); 

myTabs.getUpdater().on('update', function() 
{ 
    console.log('tab loaded'); 
});  


Finally figured it out. I hadn't realized that the properties of the "autoLoad" config object for each item of the TabPanel are actually just used as parameters for the Ext.Updater.update() method. So all I had to do was is along with the "url" and "scripts" parameters, is define the "callback" property as a function to be executed when the tab content is finished loading into its body, and its good to go.


Have you tried this?

myTabs.on("afterrender", function() {
    console.log('tab loaded');
});
0

精彩评论

暂无评论...
验证码 换一张
取 消