PDA

View Full Version : Using Ext.Toolbar.addElement



maya
26 Apr 2007, 1:45 PM
Can anyone provide an example for activating the Ext.Toolbar.addElement function?
(e.g. for adding a simple gif (not a menu item) to the Toolbar area).

Thanks,

Maya

tryanDLS
26 Apr 2007, 2:04 PM
Pass it a html string or dom object or Element.

maya
27 Apr 2007, 12:45 PM
I tried to pass the following HTML string: "tb.addElement("<b>Hello</b>");"
(tb is an Ext.Toolbar object),
but I received an error ("Invalid pointer...").

Thanks

tryanDLS
27 Apr 2007, 1:06 PM
That's not a valid html element - you could add

<span><b>Hello</b></span>

maya
28 Apr 2007, 3:13 AM
I wrote: "tb.addElement('<span><b>Hello</b></span>');" and I still receive the same error.
Did it work for you?

Thanks

Animal
28 Apr 2007, 3:43 AM
Well that's not an HTML element is it? It's a string.

maya
28 Apr 2007, 4:07 AM
Thanks A.,

Guess It will take me some more time to get into things...
In any case can you pls indicate how do I create an element (or... where is the right place in Ext to look for answers to such questions?)

Maya

Animal
28 Apr 2007, 5:41 AM
Before messing around with web UIs, you should absolutely know how to create elements!

This should be at the core of your practice: http://www.w3.org/TR/DOM-Level-2-Core/ecma-script-binding.html

Ext.DomHelper helps too.

maya
28 Apr 2007, 7:02 AM
Thanks!

tryanDLS
28 Apr 2007, 12:53 PM
Just to clarify. I initially read the doc to imply that a string containing html could be passed as the parm. That's not correct - the string has to be the id of an html element, so as Animal said, you could use DomHelper to create the element, then pass it's id.

maya
3 May 2007, 8:10 AM
Thanks.