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?
Stefan Gehrig
You can use Ext.container.AbstractContainer.insert
:
tbBar.insert(0, myComponent);
As an additional information, you can use "Ext.container.AbstractContainer.container.items.indexOf" to get an index of a specific item in your container.
var index = container.items.indexOf(component);
container.insert(index, newComponent);
来源:https://stackoverflow.com/questions/6629363/how-to-add-an-extjs-component-at-a-specific-position-index