zerostatic
8 Jul 2010, 8:45 AM
I have a button nested 2 levels deep and am trying to call a function on the top level, but can't get it to work. I set the scope to 'parent' and tried 'parent.parent'. See code below, the handler is "handler: doAlert"
var tabpanel = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
fullscreen: true,
ui: 'light',
activeItem: 0,
animation: {
type: 'flip',
cover: true
},
items: [{
title: 'Map',
cls: 'card4',
iconCls: 'settings',
xtype: 'map',
items:[mapdemo],
}, {
title: 'Search',
cls: 'card1',
iconCls: 'user',
items: [{
xtype: 'textfield',
name : 'address',
label: 'Address'
}],
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
items: [
{
text: 'Search',
ui: 'round',
handler: doAlert,
scope:parent
}
]
}
]
}]
});
//
var doAlert = function(btn, event){
alert('DO IT')
}
var tabpanel = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
fullscreen: true,
ui: 'light',
activeItem: 0,
animation: {
type: 'flip',
cover: true
},
items: [{
title: 'Map',
cls: 'card4',
iconCls: 'settings',
xtype: 'map',
items:[mapdemo],
}, {
title: 'Search',
cls: 'card1',
iconCls: 'user',
items: [{
xtype: 'textfield',
name : 'address',
label: 'Address'
}],
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
items: [
{
text: 'Search',
ui: 'round',
handler: doAlert,
scope:parent
}
]
}
]
}]
});
//
var doAlert = function(btn, event){
alert('DO IT')
}