Programmer's Guide > Interfaces > Component interface > insertBefore method
  
insertBefore method
Inserts the component newChild before the existing child component refChild. If refChild is null, insert newChild at the end of the list of children.
insertBefore(newChild [, refChild] )
Parameters
ComponentnewChild
The component to insert.
ComponentrefChild
[optional] The reference component. That is, the component before which the new component must be inserted.
Returns
Component. The component being inserted.
Throws
WindowException
HIERARCHY_REQUEST_ERR: Raised if the component is of a type that does not allow children of the type of the newChild component, or if the component to insert is one of this component's ancestors.
WRONG_WINDOW_ERR: Raised if newChild was created from a different window than the one that created this component.
NOT_FOUND_ERR: Raised if refChild is not a child of this component.