PDA

View Full Version : [CLOSED][3.1] Toolbar button 'id' uniqueness



bocockli
28 Dec 2009, 2:18 PM
Pre version 3.1, you could have two Panel objects with the same button id, for example;



// FormPanel-1
........
tbar : [{
id : 'btn.Create',
text : 'Create',
disabled : true,
handler : formCreate

// Modal window containing a FormPanel that is 'shown' from FormPanel-1
.......
tbar : [{
id : 'btn.Create',
text : 'Create',
disabled : true,
handler : formCreate
Under 3.1 this now breaks toolbar enable/disable functionality in FormPanel-1 when the modal window is called and hidden from FormPanel-1.

Not sure if this is a bug, it seems that pre 3.1 id's were private to the Panel object, now they are global?? Easily fixed but thought I would call it out....

Thanks, 3.1 is great!

aconran
28 Dec 2009, 2:47 PM
bocockli -

I'm not certain why this was working prior to Ext 3.1. Id's of components must be unique within your application. You cannot create multiple components within the same application with the same id and expect it to work reliably. This is not a bug within Ext.

You may want to take a look at the Ext.Action class which enables you to share handlers, icons, textual information and enabled/disabled status between Buttons and MenuItem's. This is an excellent way to share the same functionality across multiple components while maintaining the state of the button/menu.

Take a look at the Ext.Action example provided in the SDK.
http://www.extjs.com/deploy/dev/examples/menu/actions.html