PDA

View Full Version : [SOLVED]tabs event "active","deactive" etc... not wok



trowa
3 Jul 2007, 5:50 AM
http://outdoor.no-ip.biz/ybh/index.html
http://outdoor.no-ip.biz/ybh/tree_panel_simple.js
http://outdoor.no-ip.biz/ybh/page_layout.js
full package here http://outdoor.no-ip.biz/ybh.rar

the main function is compare with 2 books at same View.
and most 5 Views

To use compare books ,just drag left tree's book name into right Views area.
First time when you drag in,Views area will split become 2 frame,
the book will display in bottom frame,next time you drag book into which frame,the frame will auto do AJAX call.

now I have a problem,when you click on book,Views area's top frame will do AJAX call,but when you added a new tab(ex:View2),the book's click event will always fired at View2 .
I try to use panel's 'active' event to change what panel is active now,but also get the same result


//line 25 at page_layout.js
var topView=new Ext.ContentPanel(dragTargetID, {title: dragTargetID, closable: false});
topView.on('active',setPanel(topView));

Does anybody know why the active event not work currectly?

trowa
3 Jul 2007, 5:58 PM
attached files

someone can try it plz

trowa
5 Jul 2007, 4:05 AM
Sloved by myself...


page_layout.js


//page_layout.js

//...
var topView=new Ext.ContentPanel(dragTargetID, {title: dragTargetID, closable: false});
currentPanel=topView.getUpdateManager();
innerLayout.add('center', topView);
//...


Ext.get('addTabBtn').on('click', function(){
if(ViewAmount<5){
layout.add('center',dt('View'+(++ViewAmount)));
var tabs=layout.getRegion('center').getTabs();
//add tabechange event,when tab change ,it can update what panel is active now
if(!tabs.hasListener('tabchange')){
tabs.addEvents('tabchange');
tabs.addListener('tabchange',function(){
//currentPanel is the panel's UpdateManager which is active now
currentPanel=Ext.get(tabs.getActiveTab().id.substring(0,5)).getUpdateManager();
});
}
}
else{
alert('sorry ,only 5 views at the same time');
}
});



tree_panel_simple.js


//tree_panel_simple.js


//currentPanel is global var
el.on('click',function(){
currentPanel.update({
url: 'response.php?id='+this.node.id+'&',
text: "Loading...",
timeout: 30,
scripts: false
});
},this);