Print Friendly

Class Ext.CompositeElementLite

Package:Ext
Class:CompositeElementLite
Extends:CompositeElement
Defined In:CompositeElement.js
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

Method Defined By
  addString/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
  eachFunction 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...
  fillString/Array els ) : CompositeElement CompositeElement
Clears this composite and adds the elements returned by the passed selector.
  filterString 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
  itemNumber 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
  removeElementMixed el, [Boolean removeDom] ) : CompositeElement CompositeElement
Removes the specified element(s).
  replaceElementString/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.
Parameters:
  • els : String/Array
    A string CSS selector, an array of elements or an element
Returns:
  • CompositeElement
    this
This method is defined by CompositeElement.

clear

public function clear()
Removes all elements.
Parameters:
  • None.
Returns:
  • void
This method is defined by CompositeElement.

contains

public function contains()
Returns true if this composite contains the passed element
Parameters:
  • None.
Returns:
  • Boolean
This method is defined by CompositeElement.

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.
Parameters:
  • fn : Function
    The function to call
  • scope : Object
    (optional) The this object (defaults to the element)
Returns:
  • CompositeElement
    this
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.
Parameters:
  • els : String/Array
    A string CSS selector, an array of elements or an element
Returns:
  • CompositeElement
    this
This method is defined by CompositeElement.

filter

public function filter( String selector )
Filters this composite to only elements that match the passed selector.
Parameters:
  • selector : String
    A string CSS selector
Returns:
  • CompositeElement
    this
This method is defined by CompositeElement.

first

public function first()
Returns the first Element
Parameters:
  • None.
Returns:
  • Ext.Element
This method is defined by CompositeElement.

getCount

public function getCount()
Returns the number of elements in this composite
Parameters:
  • None.
Returns:
  • Number
This method is defined by CompositeElement.

indexOf

public function indexOf()
Returns true if this composite contains the passed element
Parameters:
  • None.
Returns:
  • Boolean
This method is defined by CompositeElement.

item

public function item( Number index )
Returns a flyweight Element of the dom element object at the specified index
Parameters:
  • index : Number
Returns:
  • Ext.Element
This method is defined by CompositeElementLite.

last

public function last()
Returns the last Element
Parameters:
  • None.
Returns:
  • Ext.Element
This method is defined by CompositeElement.

removeElement

public function removeElement( Mixed el, [Boolean removeDom] )
Removes the specified element(s).
Parameters:
  • el : Mixed
    The 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:
  • CompositeElement
    this
This method is defined by CompositeElement.

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/Number
    The id of an element, the Element itself, the index of the element in this composite to replace.
  • replacement : String/HTMLElement/Element
    The id of an element or the Element itself.
  • domReplace : Boolean
    (Optional) True to remove and replace the element in the document too.
Returns:
  • CompositeElement
    this
This method is defined by CompositeElement.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.