Class Ext.CompositeElementLite
Flyweight composite class. Reuses the same Ext.Element for element operations.
var els = Ext.select("#some-el div.some-class");
// or select directly from an existing element
var el = Ext.get('some-el');
el.select('div.some-class');
els.setWidth(100); // all elements become 100 width
els.hide(true); // all elements fade out and hide
// or
els.setWidth(100).hide(true);
NOTE: Although they are not listed, this class supports all of the set/update methods of Ext.Element. All Ext.Element
actions will be performed on all the elements in this collection.
Properties
-
Methods
-
Events
Public Properties
This class has no public properties.
Public Methods
|
add( String/Array els ) : CompositeElement |
CompositeElement |
Adds elements to this composite. |
|
clear() : void |
CompositeElement |
Removes all elements. |
|
contains() : Boolean |
CompositeElement |
Returns true if this composite contains the passed element |
|
each( Function fn , [Object scope ] ) : CompositeElement |
CompositeElementLite |
Calls the passed function passing (el, this, index) for each element in this composite. The element
passed is the fly... |
|
fill( String/Array els ) : CompositeElement |
CompositeElement |
Clears this composite and adds the elements returned by the passed selector. |
|
filter( String selector ) : CompositeElement |
CompositeElement |
Filters this composite to only elements that match the passed selector. |
|
first() : Ext.Element |
CompositeElement |
Returns the first Element |
|
getCount() : Number |
CompositeElement |
Returns the number of elements in this composite |
|
indexOf() : Boolean |
CompositeElement |
Returns true if this composite contains the passed element |
|
item( Number index ) : Ext.Element |
CompositeElementLite |
Returns a flyweight Element of the dom element object at the specified index |
|
last() : Ext.Element |
CompositeElement |
Returns the last Element |
|
removeElement( Mixed el , [Boolean removeDom ] ) : CompositeElement |
CompositeElement |
Removes the specified element(s). |
|
replaceElement( String/HTMLElement/Element/Number el , String/HTMLElement/Element replacement , [Boolean domReplace ] ) : CompositeElement |
CompositeElement |
Replaces the specified element with the passed element. |
Public Events
This class has no public events.
Method Details
add
public function add( String/Array els
)
Adds elements to this composite.
clear
public function clear()
contains
public function contains()
Returns true if this composite contains the passed element
each
public function each( Function fn
, [Object scope
] )
Calls the passed function passing (el, this, index) for each element in this composite.
The element
passed is the flyweight (shared) Ext.Element instance, so if you require a
a reference to the dom node, use el.dom.
This method is defined by CompositeElementLite.
fill
public function fill( String/Array els
)
Clears this composite and adds the elements returned by the passed selector.
filter
public function filter( String selector
)
Filters this composite to only elements that match the passed selector.
Parameters:
selector
: StringA string CSS selector
Returns:
first
public function first()
Returns the first Element
getCount
public function getCount()
Returns the number of elements in this composite
indexOf
public function indexOf()
Returns true if this composite contains the passed element
item
public function item( Number index
)
Returns a flyweight Element of the dom element object at the specified index
This method is defined by CompositeElementLite.
last
public function last()
removeElement
public function removeElement( Mixed el
, [Boolean removeDom
] )
Removes the specified element(s).
Parameters:
el
: MixedThe id of an element, the Element itself, the index of the element in this composite
or an array of any of those.
removeDom
: Boolean(optional) True to also remove the element from the document
Returns:
replaceElement
public function replaceElement( String/HTMLElement/Element/Number el
, String/HTMLElement/Element replacement
, [Boolean domReplace
] )
Replaces the specified element with the passed element.
Parameters:
el
: String/HTMLElement/Element/NumberThe id of an element, the Element itself, the index of the element in this composite
to replace.
replacement
: String/HTMLElement/ElementThe id of an element or the Element itself.
domReplace
: Boolean(Optional) True to remove and replace the element in the document too.
Returns: