Reputation: 2544
is it actually possible to addAfter or insertAfter for components?
The documentation goes on about .add() to throw something to the end of a container but I'm looping through field's in my form and displaying their errors after each one. So I need to add a new component after these.
It seems that it's only possible on the actual element of these components? something like:
errorElement = Ext.create('Ext.Container', {
//stuff
});
errorElement.element.insertAfter(field.element);
This is fine, it looks fine but if I do the following, the component doesn't seem to exist where the Dom stuff is:
Ext.Viewport.getActiveItem().query('panel'); // []
Ext.ComponentQuery.query('panel'); // Ext.apply.create.Class
Please don't tell me that I'm the only person who is asking about this sort of thing, how is this not highlighted anywhere in the documentation?
Upvotes: 1
Views: 593
Reputation: 13516
You can use Container.insert() method that Inserts a Component into this Container at a specified index
.
However inserting an error Component (Component? not Element?) doesn't sound like a good idea. Default form fields already have an element for displaying errors inside them, and you can tweak its appearance through CSS.
Upvotes: 1