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

Roberto Schuster picture Roberto Schuster · Jul 8, 2011 · Viewed 11.3k times · Source

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?

Answer

Stefan Gehrig picture Stefan Gehrig · Jul 8, 2011

You can use Ext.container.AbstractContainer.insert:

tbBar.insert(0, myComponent);