How to add an ExtJs component at a specific position (index)

extjs, extjs3, extjs4

I have a ToolBar with some components (TextFields and Buttons) and I would like to dynamically add a component (TextField, for example) before the other components.

I tried tbBar.add(myComponent); without success.

Any idea?

Best Solution

You can use Ext.container.AbstractContainer.insert:

tbBar.insert(0, myComponent);