arpeggian
24 Jul 2012, 1:52 AM
Dear all
I'm building extjs-based applications. My application has many links in the navigation, and every link clicked will create a new tab in contentPanel. this my tree listener code:
url = sharedData.rootDir + data.url +'?id='+node.getId();
if (node.isLeaf()) {
var tab = contentPanel.add({
// we use the tabs.items property to get the length of current items/tabs
title: node.get('text'),
id: node.getId(),
closable: true,
forceFit:true,
autoScroll: true,
layout:'fit',
autoLoad: {
//url: sharedData.rootDir + "app/gallery/galleryFoto.php",
url: url,
scripts: true,
listeners: {
beforeload: function(){ viewport.setLoading(); },
load: function(){
viewport.setLoading(false);
},
exception: function(){
Ext.Msg.alert('Error','Halaman yang anda maksud tidak ada');
viewport.setLoading(false);
}
}
},
listener: {
activate: function(){
alert('activate');
contentPanel.items.each(function(c){c.disable(); alert(c.getId());})
},
focus: function(){
alert('focus');
contentPanel.items.each(function(c){c.disable(); alert(c.getId());})
}
}
});
if(tab)
contentPanel.setActiveTab(tab);
contentPanel.items.each(function(c){ if (c.getId() != tab.getId()) c.query('input').disable(); })
}
}
},
The problem is, when a single tab (A) there is a component with id: 'MyField' and in another tab (B) there is also a component with the same id, the id: 'MyField' .. then there is the field 'MyField' in tab A will disappear, and the layout or arrangement of B field in the tab would be a mess.
if there is no other way than to use a unique id for each component, although different tab. or any other means, such as adding listeners when ditambahakan tab, then the other tab is disabled? or multiple fields / components is disabled?
please help me .. sorry for my bad english. thank you
regards
I'm building extjs-based applications. My application has many links in the navigation, and every link clicked will create a new tab in contentPanel. this my tree listener code:
url = sharedData.rootDir + data.url +'?id='+node.getId();
if (node.isLeaf()) {
var tab = contentPanel.add({
// we use the tabs.items property to get the length of current items/tabs
title: node.get('text'),
id: node.getId(),
closable: true,
forceFit:true,
autoScroll: true,
layout:'fit',
autoLoad: {
//url: sharedData.rootDir + "app/gallery/galleryFoto.php",
url: url,
scripts: true,
listeners: {
beforeload: function(){ viewport.setLoading(); },
load: function(){
viewport.setLoading(false);
},
exception: function(){
Ext.Msg.alert('Error','Halaman yang anda maksud tidak ada');
viewport.setLoading(false);
}
}
},
listener: {
activate: function(){
alert('activate');
contentPanel.items.each(function(c){c.disable(); alert(c.getId());})
},
focus: function(){
alert('focus');
contentPanel.items.each(function(c){c.disable(); alert(c.getId());})
}
}
});
if(tab)
contentPanel.setActiveTab(tab);
contentPanel.items.each(function(c){ if (c.getId() != tab.getId()) c.query('input').disable(); })
}
}
},
The problem is, when a single tab (A) there is a component with id: 'MyField' and in another tab (B) there is also a component with the same id, the id: 'MyField' .. then there is the field 'MyField' in tab A will disappear, and the layout or arrangement of B field in the tab would be a mess.
if there is no other way than to use a unique id for each component, although different tab. or any other means, such as adding listeners when ditambahakan tab, then the other tab is disabled? or multiple fields / components is disabled?
please help me .. sorry for my bad english. thank you
regards