PDA

View Full Version : Button handler not being called?



m.curtis
11 Nov 2010, 3:42 PM
I'm trying to implement a button handler, but no matter what I try the function doesn't seem to be called. I want the "mapSelected" function to be called. Any ideas?


var rootPanel;

Ext.setup({
onReady: function() {
var red = new Ext.Panel({
style: "background-color: #B22222; color: white;",
title: "Red", html: "Red",
dockedItems: [
{
dock: 'bottom',
xtype: 'button',
ui: 'decline',
text: 'Map',
stretch: 'false',
align: 'center',
handler: mapSelected
}
]
});

var amber = {
style: "background-color: #FFBF00; color: white;",
title: "Amber", html: "Amber"
};

var green = {
style: "background-color: #3B7E00; color: white;",
title: "Green", html: "Green"
};

var mapSelected = function () {
console.log('blah');
rootPanel.setActiveItem(3);
}

var map = {
xtype: 'map',
useCurrentLocation: true
}

rootPanel = new Ext.Panel({
fullscreen: true,
cardSwitchAnimation: {type: 'slide'},
layout: 'card',
items: [red, amber, green, map],
listeners: {
cardswitch : function() {
console.log('cardswitch!');
}
}
});
}
});

evant
11 Nov 2010, 5:47 PM
You declare it after you assign, essentially:



var x = y;
var y = 1;
console.log(x);