One of the common ext Methods

Source: Internet
Author: User
Tags html encode html decode

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 & <>"
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

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/wangjh100/archive/2010/08/25/5837340.aspx

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.