PDA

View Full Version : [CLOSED][3.0rc2] Empty tbar for a window isn't empty



ralam
19 Jun 2009, 12:19 PM
The following code creates an empty button in the toolbar.

var config = {
tbar: [],
width: 100,
height: 100
};

var w = new Ext.Window(config);
w.show();

In 3.0rc1.1 and prior, the toolbar was empty as expected.

Thanks...

jsakalos
19 Jun 2009, 1:03 PM
Should I move this thread to Bugs?

ralam
19 Jun 2009, 1:51 PM
That's fine. Wasn't sure if y'all had a patch or quickfix available.

We have our dev complete date coming up rather soon and this issue is blocking us moving up to the latest ExtJS bits.

Thanks...

mjlecomte
19 Jun 2009, 4:10 PM
If you believe there's a bug please have a post within the thread that satisfies the request for posting a bug as shown here:
http://extjs.com/forum/showthread.php?t=71015

If I test your code I see an empty top toolbar in the window, as expected. The linked post has sections where you can include pictures, etc. as well as "what you expected" vs "what you saw".

ralam
19 Jun 2009, 8:48 PM
Ext version tested:



Ext 3.0 rev rc2





Browser versions tested against:



IE7

FF3 (firebug 1.3.3 installed)

Safari 4





Operating System:



OS X 10.5.7

Windows Server 2003 SP2





Description:



See screenshots. First one is rc1.1, the second rc2.





Test Case:






var config = {
tbar: [],
width: 100,
height: 100
};

var w = new Ext.Window(config);
w.show();





Steps to reproduce the problem:



Execute the above code





The result that was expected:



An empty toolbar





The result that occurs instead:



A toolbar with an empty button





Screenshot or Video:



attached





Debugging already done:



The problem occurs because Ext.Toolbar's add() function has changed between rc1.1 and rc2.

In rc1.1, add() parsed the arguments itself and would end up calling addButton() with the empty array. addButton would do the right thing by looping over the empty array and adding nothing.

In rc2 add() is now just a call to the superclass, Ext.Container. In the superclass' add(), it will end up calling this.applyDefaults() with the empty array, which goes to Ext.Toolbar's implementation. Ext.Toolbar's applyDefaults() will apply the internalDefaults to the empty array creating an array with one item in it, which ends up creating the empty button.





Possible fix:



not provided

nathand
19 Jun 2009, 9:20 PM
I just came across this myself. The proper way to declare and empty toolbar is:

tbar: {}

ralam
19 Jun 2009, 9:30 PM
That isn't exactly right. Per the docs for tbar config option for a Window:
"This can be a Ext.Toolbar object, a toolbar config, or an array of buttons/button configs to be added to the toolbar."

In our case, we have a dynamic array that may contain 0-n buttons so it cannot be an object. An object would work if we were trying to define a toolbar config.

And as per my bug report, this was working properly in previous versions.

Thanks...

jsakalos
20 Jun 2009, 12:30 AM
OK, moving to bugs; devel team will decide what they'll do with it.

mjlecomte
20 Jun 2009, 5:16 AM
Everyone in this thread up to this point has svn access correct? Did you test it against the latest in svn because I don't see this problem?

jsakalos
20 Jun 2009, 5:43 AM
I works fine with the latest svn; no blank button in the toolbar.

mjlecomte
20 Jun 2009, 6:08 AM
Ok, going to update status of this one to CLOSED.