View Full Version : Access Toolbar Items after they are created
mcbeev
21 Jun 2007, 12:28 PM
Im having a little trouble trying to show a toolbar item with the .show method. I have created a toolbar called tb like so:
var tb = new Ext.Toolbar('toolbar', [{'Start', menu: {..more nested items...}}]);
later on in a mouseover handeler im trying to do something like:
function onMouseOver(e)
{
var item = tb.items.get(0);
item.show();
}
am I close with this ?
evant
21 Jun 2007, 2:29 PM
From the documentation, there doesn't seem to be able to be a way to retrieve items from a toolbar. Your best bet would be to create references to them in your code:
var tb= new Ext.Toolbar('el');
var b = new Ext.Toolbar.Button({});
tb.add(b);
//now have a reference to b.
tryanDLS
21 Jun 2007, 2:44 PM
You can access the toolbar.items collection - it's a MixedCollection object.
mcbeev
22 Jun 2007, 9:13 AM
Thanx for the replies. I think the .get method is correct to get to the items collections and the item that I get from .get(0) is a vaild element, but the show method still doesnt seem to work. What would be the normal way to show the first item in a toolbar ? I thought about trying to use fireEvent('click') but couldnt get that to work either.
tryanDLS
22 Jun 2007, 9:32 AM
Look at the toolbar html in Firebug before and after you call show. Is anything happening?
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.