ExtJS learning ----------- Ext. Array, ExtJS extension to the Array in javascript (example), ext. array. foreach

Source: Internet
Author: User

ExtJS learning ----------- Ext. Array, ExtJS extension to the Array in javascript (example), ext. array. foreach

(1) clean

Var arr = [1, 2, null, 3, '']; alert (Ext. array. clean (arr); // clean object :( value = null) | (value = undefined) | (! AllowEmptyString? Value = '': false) | (Ext. isArray (value) & value. length = 0) // The result is 1, 2, 3.
(2) difference

// Differencevar arr1 = [, 3]; var arr2 = [, 6]; alert (Ext. Array. difference (arr1, arr2); // The result is 1, 3.
(3) each

// Eachvar arr = [1, 2, 4]; Ext. array. each (arr, function (item) {if (item = 4) {return false;} alert (item ); // when the function returns false internally, iteration will be stopped}); // result: the pop-up dialog box appears, showing 1 2 3, not 4
(4) erase

// Erasevar arr = [1, 3, 4, 5]; alert (Ext. Array. erase (arr, 2, 2); // The Array starts from 0. Delete two elements from the position where the subscript is 2 (inclusive). // result: 1, 2, 3
(5) every

// Everyvar arr = [1, 2, 5, 6, 9, 10]; var flag = Ext. array. every (arr, function (item) {if (item >=7) {return false ;}else {return true ;}); alert (flag); // result: false
(6) filter

// Filtervar arr = [1, 2, 3, 4, 10, 18, 23]; var newarr = Ext. array. filter (arr, function (item) {if (item> 10) {return false ;}else {return true ;}); alert (newarr); // result: 1, 2, 3, 4, 10
(7) include

// Includevar arr = [1, 2, 3, 4]; Ext. Array. include (arr, 2); alert (arr); // result: 1, 2, 3, 4
(8) unique

// Unqiuevar arr = [, 5, 21,]; alert (Ext. array. unique (arr); // remove the repeated items in the array using the characteristics of the js object. The key of the obj cannot be repeated var obj ={}; for (var I = 0, len = arr. length; I <len; I ++) {obj [arr [I] = true; // removes the repeated entries in the array} // alert (Ext. encode (obj); var uniquearr = []; for (var I in obj) {if (obj. hasOwnProperty (I) {uniquearr. push (I) ;}} alert (uniquearr); // result: 1, 2, 3, 4, 5, 21, 23












Call extjs in javascript

Hi.baidu.com/ext_js
I think you should be very satisfied with this.
Ext. Msg. show ("...");

Extjs learning problems, really depressed recently want to learn extjs, download the ext-230 on the official website, always don't do well

First, the problem may be that the order of the ext package is wrong. We recommend that you write the package order according to the api documentation ,,,
I don't know much about others. I am also a beginner. If you are interested, you can communicate with me. In fact, for beginners, just look at the api and examples. ext4.0 charges fees, so if you don't need it very much, don't use 4.0 or less ,,

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.