Extjs memorandum (9)-ext common attributes and Methods Summary [end of series]

Source: Internet
Author: User
Tags html encode html decode

Preface

Keywords: farmer's uncle, ext. Is, copyto, flatten, unique, pluck, invoke, format, grid, array, function, learning, notes, summary, Skills

Extjs has not been used for a long time and has taken many detours. Because extjs will not be used for a short period of time, all articles in this series will summarize, sort out, and supplement extjs to be forgotten, most of the series of articles are collected and sorted out, a small part of their own experiences and supplements, focusing on practice, providing complete code ,:)

 

 

Series

1. extjs memo (1) -- Form (1) [control usage]
2. extjs memorandum (2) -- Form (2) [control encapsulation]
3. extjs memorandum (3) -- Form (3) [data verification]
4. extjs memorandum (4) -- Form (4) [data submission]
5. extjs memorandum (5) -- girdpanl table (1) [basic usage]
6. extjs memo (6) -- girdpanl table (2) [search by Page]
7. extjs memorandum (7) -- girdpanl Table (3) [Statistics | view and modify a single row Record]
8. extjs memorandum (8)-management interface setup and other components
9. extjs memorandum (9)-ext common attributes and methods [end of series]

 

Body

I. ext

1.1 Ext. isempty (v, allowblank) // whether it is null [LINK]

1.2 Ext. isarray (v) // whether it is an array set

1.3 Ext. isprimitive (v) // is the basic data type string/number/Boolean?

1.4 Ext. isfunction (v) // whether it is a function

1.5 Ext. isnumber (v) // whether it is a number

1.6 Ext. isstring (v) // whether it is a string

1.7 Ext. isboolean (v) // whether it is a bool Value

1.8 Ext. isie/isie6/isie7/isie8... // judge the browser

1.9 Ext. iswindows/islinux/ismac/isair // judgment platform (Operating System)

1.10 Ext. isdefined // whether the object has been defined

1.11 Ext. ID (El, prefix) // return the unique id value. The El bit element ID is prefixed.

1.12 Ext. urlencode (O, pre) // convert JSON data to URL parameter strings, for example, {A: 1, B: 2 }=> A = 1 & B = 2

1.13 Ext. urldecode (string, overwrite) // convert the URL parameter list to JSON format data. If overwrite is true, then the parameter values with the same name will overwrite the previous parameter values with the same name (the default value is false, that is, the parameter values are not overwritten and returned in array format)

1.15 Ext. each (array, FN, scope) // traverses the array, for example, ext. each ([1, 2, 3], function (value, index, a) {// index: index number, 0 start value: Current Value A: array reference });

1.16 Ext. encode (o) // converts an object to a JSON string. For more information and usage, see

1.17 Ext. Decode (o) // converts a JSON string to an object

Ext-more.js

1.18 Ext. Combine () // array merge

1.19 Ext. Num (value, defaultvalue) // if it is a number, return itself directly. Otherwise, return the default value. Note that "5" will return the default value here.

1.20 Ext. copyto (DEST, source, names) // copy the names attribute list in source to DeST.

1.21 Ext. Unique (ARR) // removes repeated elements from the array to keep each element unique.

1.22 Ext. Clean (ARR) // copy an array ?!

1.23 Ext. Flatten (ARR) // converts a multi-dimensional array to a one-dimensional array.

1.24 Ext. Min (ARR, comp) // find the smallest element in the array

1.25 Ext. Max (ARR, comp) // find the largest element in the array

1.26 Ext. Mean (ARR) // calculate the average value of array elements (sum divided by number)

1.27 Ext. partition (ARR, truth) // Splits a new two-dimensional array based on the bool value of the ARR element and returns Example 1: ext. partition ([true, false, true, true, false]); // [[true, true, true], [false, false] Example 2: ext. partition (ARR, function (VAL) {return val = "class1 "});

1.28 Ext. Invoke (ARR, methodname,/* ARGs... */) // executes the methodname method of the object in the ARR array. ARGs is the parameter of the method and returns the execution result array.

1.29 Ext. pluck (ARR, Prop) // return the new array Ext. pluck (ARR, "classname"); => [arr1.classname, arr2.classname]

1.30 ext.zip ({arrays | nodelists}, {function}) // compress multiple arrays into one array, ext.zip ([, 3], [, 6]); // [[], [], [], supports function-defined Merging

1.31 Ext. Type (object) // type of the returned object: String, number, Boolean, function, object, array, Regexp, element, nodelist, textnode, whitespace

 

Ii. Ext. util. Format

2.1 Ext. util. format. capitalize (value); // uppercase
2.2 Ext. util. format. ellipsis (value, Len, word); // capture the LEN Length from the start of the string. If the length of the LEN Length is exceeded, use... word is a Boolean value. If it is true, it is truncated from ''and '','. ','! ','? 'Intercept the front (LEN) in the keyword, ellipsis ("ABCDE. fghijkl", 10, true), and return ABCDE
2.3 ext.util.format.html encode (value); // html encoding, replace & <> "with & amp; & lt; & gt; & quot;
2.4 ext.util.format.html decode (value); // html decoding, opposite to the preceding
2.5 EXT. util. format. Trim (value); // intercept the Left and Right spaces of the string.
2.6 Ext. util. format. substr (value, start, length); // return a substring of the length starting from the start position specified by the value.
2.7 Ext. util. format. lowercase (value); // converts uppercase letters.
2.8 Ext. util. format. uppercase (value); // converts lowercase letters.
2.9 Ext. util. format. striptags (V); // remove the HTML Tag:/<\/? [^>] +>/Gi
2.10 Ext. util. format. usmoney (V); // convert to the currency form of the '$' symbol
2.11 Ext. util. format. Date (v, format); // format the date output. The default format is "M/D/y"
2.12 Ext. util. format. Round (value, precision); // rounding, precision indicates the exact number of digits
2.13 Ext. util. format. Number (v, format); // format the number display.
2.14 Ext. util. format. nl2br (value); // replace '\ n' in the string with' <br/>'
2.15 Ext. util. format. filesize (value); // convert the number of bytes to a larger unit of KB and MB. filesize (1024) = 1kb
2.16 Ext. util. format. defaultvalue (value, defaultvalue); // if the value is undefined or is a Null String, defaultvalue is returned.
2.17 Ext. util. format. stripscripts (V); // remove the script tag
2.18 Ext. util. format. UNDEF (value); // if the value is not defined, an empty string is returned. Otherwise, the value itself is returned.

 

Iii. Extend original JS objects

3.1 string

3.1.1. Format (Format) // The same usage as C #

3.1.2. Toggle (value, other) // exchange value. If the current value is equal to value, other is assigned.

3.2 Array

3.2.1. indexof (o) // returns the position of the element O in the array arrayobject. If no value is found,-1 is returned.

3.2.2. Remove (o) // Delete element O from array arrayobject

3.3 Function

3.3.1. createinterceptor (FCN, scope) // create a blocking method. If FCN returns false, the original method will not be executed. See here

3.3.2. createcallback (/* ARGs... */) // create a callback with a function without any parameters as the parameter, but the existing method already has the parameter. If you write it directly, you can use this to create a callback, similar to function () {// actually called with parameters}. For details, see here 1. Here 2.

3.3.3. createdelegate (OBJ, argS, appendargs) // create a delegate. You can access the attributes and methods in OBJ by yourself, as shown in the following figure.

3.3.4. Defer (millis, OBJ, argS, appendargs) // scheduled execution. The original method is executed after millis milliseconds. See here.

3.3.5. createsequence (FCN, scope) // In the Ext-more.js, create a combination method and execute the original method + FCN, see here

 

4. Others

4.1 form

4.1.1 obtain the key/value set of all form elements at a time.

Form1.form. getvalues () // form1 is Ext. formpanel, for example:

// Note
VaR conn = new Ext. Data. Connection ();
Conn. Request ({
URL: 'submit. aspx? Method = submit4 ',
// This corresponds to Params. If it is post, the server can obtain data from request. Form, and vice versa.
Method: 'post', // get
Params: form1.form. getvalues (),
Success: function (response, opts ){
Msginfo (response. responsetext );
}
});

Form1.form. setvalues (values) // form1.form. setvalues ({ID: 1, name: 'abbcc '}) value assignment

4.1.2 obtain a value assignment for a form Element

4.1.2.1 form1.form. findfield ('textbox '). getvalue ()

4.1.2.2 form1.form. getvalues (). textbox

4.1.2.3 form1.form. getfieldvalues (). textbox

4.2 switch skin

Ext. util. CSS. swapstylesheet ("theme", "Resources/CSS/EXT/xtheme-orange.css"); // note the path

 

 

Note::

1. The ext version of this series is 3.0.0.

2. The latest source code has been downloaded in article 8 of the series.

3. For more information about the advantages of extjs, see my answer in the first comment of the series.

 

 

Article reference and recommendations

1. Everything is possible about the basic series of ext

2. Google: ext API details

3. Ext Research (1) -- Use of some new functions

4. Ext. template Analysis

5. Ext extension of function classes

 

 

Conclusion

We recommend that you read the source code and source code analysis articles.

 

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.