source:
trunk/workshop-routing-foss4g/web/ext/src/core/CompositeElementLite-more.js
@
76
Revision 76, 2.0 KB checked in by djay, 12 years ago (diff) | |
---|---|
|
Rev | Line | |
---|---|---|
[76] | 1 | /*! |
2 | * Ext JS Library 3.4.0 | |
3 | * Copyright(c) 2006-2011 Sencha Inc. | |
4 | * licensing@sencha.com | |
5 | * http://www.sencha.com/license | |
6 | */ | |
7 | /** | |
8 | * @class Ext.CompositeElementLite | |
9 | */ | |
10 | Ext.apply(Ext.CompositeElementLite.prototype, { | |
11 | addElements : function(els, root){ | |
12 | if(!els){ | |
13 | return this; | |
14 | } | |
15 | if(typeof els == "string"){ | |
16 | els = Ext.Element.selectorFunction(els, root); | |
17 | } | |
18 | var yels = this.elements; | |
19 | Ext.each(els, function(e) { | |
20 | yels.push(Ext.get(e)); | |
21 | }); | |
22 | return this; | |
23 | }, | |
24 | ||
25 | /** | |
26 | * Returns the first Element | |
27 | * @return {Ext.Element} | |
28 | */ | |
29 | first : function(){ | |
30 | return this.item(0); | |
31 | }, | |
32 | ||
33 | /** | |
34 | * Returns the last Element | |
35 | * @return {Ext.Element} | |
36 | */ | |
37 | last : function(){ | |
38 | return this.item(this.getCount()-1); | |
39 | }, | |
40 | ||
41 | /** | |
42 | * Returns true if this composite contains the passed element | |
43 | * @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection. | |
44 | * @return Boolean | |
45 | */ | |
46 | contains : function(el){ | |
47 | return this.indexOf(el) != -1; | |
48 | }, | |
49 | ||
50 | /** | |
51 | * Removes the specified element(s). | |
52 | * @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite | |
53 | * or an array of any of those. | |
54 | * @param {Boolean} removeDom (optional) True to also remove the element from the document | |
55 | * @return {CompositeElement} this | |
56 | */ | |
57 | removeElement : function(keys, removeDom){ | |
58 | var me = this, | |
59 | els = this.elements, | |
60 | el; | |
61 | Ext.each(keys, function(val){ | |
62 | if ((el = (els[val] || els[val = me.indexOf(val)]))) { | |
63 | if(removeDom){ | |
64 | if(el.dom){ | |
65 | el.remove(); | |
66 | }else{ | |
67 | Ext.removeNode(el); | |
68 | } | |
69 | } | |
70 | els.splice(val, 1); | |
71 | } | |
72 | }); | |
73 | return this; | |
74 | } | |
75 | }); |
Note: See TracBrowser
for help on using the repository browser.