ExtJS learning -------- query method learning in Ext. Element (Instance)

Source: Internet
Author: User

ExtJS learning -------- query method learning in Ext. Element (Instance)


Example: (you can copy the code to demonstrate the experiment results) <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + PHByZSBjbGFzcz0 = "brush: java;"> Ext. onReady (function () {Ext. create ('ext. panel. panel ', {// create a Panel title: 'My panel', width: '000000', height: 100%, renderTo: Ext. getBody (), html: 'I am sp content I am d2 content'}); // query is the most common method: // Ext. dom. element get fly getDomvar d1 = Ext. get ('d1 '); var sp = Ext. get ('SP '); // query system method: // 1: contains: determines whether the element contains another element alert (d1.contains (sp )); alert (d1.contains ('SP '); // 2: child: select the element that matches the selector from the direct sub-element of the element (only one element is returned, the second parameter of the two parameters is optional. If it is set to true, the native HTMLElement var metadata = d1.child ('span ') is obtained. // Ext. dom. elementalert (ch. dom. innerHTML); var ch2 = d1.child ('span ', true); // HTMLElementalert (ch. innerHTML); // 3: down: select the child element of the element that matches the selector. // findParentNode and up: find the parent element var ready = d1.down ('# d2') and alert (ch1.dom. innerHTML); // 4: first: select the first child element of the element // last: select the last child element of the element var f1 = d1.first ('div '); alert (f1.dom. innerHTML); // 5: findParent: Find the parent element of the element that matches the simple selector. // parent: return the parent element var parent = sp. findParent ('div '); alert (parent. innerHTML); // 6: is: determines whether the element matches the selection character alert (d1.is ('div '); // 7: next: select the next element of the same layer // prew: select the previous element var next = sp. next (); alert (next. dom. nodeName); // 8: Ext. query: gets the element (Ext. dom. element. query) var arr = Ext. query ('span ', 'd1'); // HTMLElement [] Ext. array. each (arr, function (item) {alert (item. innerHTML) ;}); // 9: Ext. select/Ext. dom. element. select: gets the element set based on the selection operator // returns all element sets: Ext. dom. compositeElementLite (HTMLElemennt)/Ext. dom. compositeElement (Ext. dom. element) // parameter description: three parameters, // 1: selector (do not use id selector) // 2: returned collection object (boolean false: Ext. dom. compositeElementLite true: Ext. dom. compositeElement) // 3: Specify the root node to start searching // var list1 = Ext when the parameter is false. select ('span ', false, 'd1'); // Ext. dom. compositeElementLiteExt. array. each (list1.elements, function (el) {alert (el. innerHTML) ;}); // var list2 = Ext. select ('span ', true, 'd1'); // Ext. dom. compositeElementExt. array. each (list2.elements, function (el) {alert (el. dom. innerHTML );});});


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.