PDA

View Full Version : [CLOSED] multiple toolbars and buttons kill events



slchorne
20 Oct 2011, 1:10 PM
I'm not sure why, but as soon as I define a toolbar (even if it isn't rendered or added to a panel) all button event handlers stop working. In the example below the button works just fine, but as soon as i define the variable 't' (at the end of the code) the button stops working.

Any thoughts ?



Ext.application({
name: 'myApp',
launch: function() {

// create the main panel
var mainPanel = Ext.create('Ext.Panel',{
layout: 'hbox',
items: [
{
xtype: 'toolbar',
docked: 'bottom',
items: [
{
xtype: 'button',
text: 'bah',
ui: 'decline',
}
]
}
]
});
// Add and render the main panel
Ext.Viewport.add( mainPanel );

}

});

// -- this def, kills all button events
var t = Ext.create('Ext.Toolbar',{
docked: 'top',
title: 'test',
items: [
{
xtype: 'button',
text: 'foo',
ui: 'decline',
}
]
});

slchorne
21 Oct 2011, 9:32 AM
It looks like it is related to this bug :

http://www.sencha.com/forum/showthread.php?150940-Button-loosing-listener-if-another-button-is-created-after-it

Jamie Avins
31 Oct 2011, 10:44 AM
Probably the same issue, but always good to have another test case. We'll look into it.

Jacky Nguyen
17 Jan 2012, 10:03 AM
Similarly to this thread (http://www.sencha.com/forum/showthread.php?150940-Button-loosing-listener-if-another-button-is-created-after-it) you should never instantiate a component outside of onReady (or Application's launch) callback.