Ext.data.JsonP.Ext_Array({"mixins":[],"code_type":"nop","inheritable":false,"component":false,"meta":{"author":["Jacky Nguyen "],"docauthor":["Jacky Nguyen "]},"mixedInto":[],"uses":[],"aliases":{},"parentMixins":[],"superclasses":[],"members":{"event":[],"property":[],"css_var":[],"method":[{"meta":{},"owner":"Ext.Array","tagname":"method","name":"clean","id":"method-clean"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"clone","id":"method-clone"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"contains","id":"method-contains"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"difference","id":"method-difference"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"each","id":"method-each"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"erase","id":"method-erase"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"every","id":"method-every"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"filter","id":"method-filter"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"flatten","id":"method-flatten"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"forEach","id":"method-forEach"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"from","id":"method-from"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"include","id":"method-include"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"indexOf","id":"method-indexOf"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"insert","id":"method-insert"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"intersect","id":"method-intersect"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"map","id":"method-map"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"max","id":"method-max"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"mean","id":"method-mean"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"merge","id":"method-merge"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"min","id":"method-min"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"pluck","id":"method-pluck"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"push","id":"method-push"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"remove","id":"method-remove"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"replace","id":"method-replace"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"slice","id":"method-slice"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"some","id":"method-some"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"sort","id":"method-sort"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"splice","id":"method-splice"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"sum","id":"method-sum"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"toArray","id":"method-toArray"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"toMap","id":"method-toMap"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"union","id":"method-union"},{"meta":{},"owner":"Ext.Array","tagname":"method","name":"unique","id":"method-unique"}],"css_mixin":[],"cfg":[]},"tagname":"class","extends":null,"html":"

Files

A set of useful static methods to deal with arrays; provide missing methods for older browsers.

\n
Defined By

Methods

Ext.Array
view source
( Array array ) : Array
Filter through an array and remove empty item as defined in Ext.isEmpty\n\nSee filter ...

Filter through an array and remove empty item as defined in Ext.isEmpty

\n\n

See filter

\n

Parameters

Returns

Ext.Array
view source
( Array array ) : Array
Clone a flat array without referencing the previous one. ...

Clone a flat array without referencing the previous one. Note that this is different\nfrom Ext.clone since it doesn't handle recursive cloning. It's simply a convenient, easy-to-remember method\nfor Array.prototype.slice.call(array)

\n

Parameters

Returns

Ext.Array
view source
( Array array, Object item ) : Boolean
Checks whether or not the given array contains the specified item ...

Checks whether or not the given array contains the specified item

\n

Parameters

  • array : Array

    The array to check

    \n
  • item : Object

    The item to look for

    \n

Returns

  • Boolean

    True if the array contains the item, false otherwise

    \n
Ext.Array
view source
( Array arrayA, Array arrayB ) : Array
Perform a set difference A-B by subtracting all items in array B from array A. ...

Perform a set difference A-B by subtracting all items in array B from array A.

\n

Parameters

Returns

Ext.Array
view source
( Array/NodeList/Object iterable, Function fn, [Object scope], [Boolean reverse] ) : Boolean
Iterates an array or an iterable value and invoke the given callback function for each item. ...

Iterates an array or an iterable value and invoke the given callback function for each item.

\n\n
var countries = ['Vietnam', 'Singapore', 'United States', 'Russia'];\n\nExt.Array.each(countries, function(name, index, countriesItSelf) {\n    console.log(name);\n});\n\nvar sum = function() {\n    var sum = 0;\n\n    Ext.Array.each(arguments, function(value) {\n        sum += value;\n    });\n\n    return sum;\n};\n\nsum(1, 2, 3); // returns 6\n
\n\n

The iteration can be stopped by returning false in the function callback.

\n\n
Ext.Array.each(countries, function(name, index, countriesItSelf) {\n    if (name === 'Singapore') {\n        return false; // break here\n    }\n});\n
\n\n

Ext.each is alias for Ext.Array.each

\n

Parameters

  • iterable : Array/NodeList/Object

    The value to be iterated. If this\nargument is not iterable, the callback function is called once.

    \n
  • fn : Function

    The callback function. If it returns false, the iteration stops and this method returns\nthe current index.

    \n

    Parameters

    • item : Object

      The item at the current index in the passed array

      \n
    • index : Number

      The current index within the array

      \n
    • allItems : Array

      The array itself which was passed as the first argument

      \n

    Returns

    • Boolean

      Return false to stop iteration.

      \n
  • scope : Object (optional)

    The scope (this reference) in which the specified function is executed.

    \n
  • reverse : Boolean (optional)

    Reverse the iteration order (loop from the end to the beginning)\nDefaults false

    \n

Returns

  • Boolean

    See description for the fn parameter.

    \n
Ext.Array
view source
( Array array, Number index, Number removeCount ) : Array
Removes items from an array. ...

Removes items from an array. This is functionally equivalent to the splice method\nof Array, but works around bugs in IE8's splice method and does not copy the\nremoved elements in order to return them (because very often they are ignored).

\n

Parameters

  • array : Array

    The Array on which to replace.

    \n
  • index : Number

    The index in the array at which to operate.

    \n
  • removeCount : Number

    The number of items to remove at index.

    \n

Returns

Ext.Array
view source
( Array array, Function fn, Object scope ) : Boolean
Executes the specified function for each array element until the function returns a falsy value. ...

Executes the specified function for each array element until the function returns a falsy value.\nIf such an item is found, the function will return false immediately.\nOtherwise, it will return true.

\n

Parameters

  • array : Array
    \n
  • fn : Function

    Callback function for each item

    \n
  • scope : Object

    Callback function scope

    \n

Returns

  • Boolean

    True if no false value is returned by the callback function.

    \n
Ext.Array
view source
( Array array, Function fn, Object scope ) : Array
Creates a new array with all of the elements of this array for which\nthe provided filtering function returns true. ...

Creates a new array with all of the elements of this array for which\nthe provided filtering function returns true.

\n

Parameters

  • array : Array
    \n
  • fn : Function

    Callback function for each item

    \n
  • scope : Object

    Callback function scope

    \n

Returns

Ext.Array
view source
( Array array ) : Array
Recursively flattens into 1-d Array. ...

Recursively flattens into 1-d Array. Injects Arrays inline.

\n

Parameters

  • array : Array

    The array to flatten

    \n

Returns

Ext.Array
view source
( Array array, Function fn, [Object scope] )
Iterates an array and invoke the given callback function for each item. ...

Iterates an array and invoke the given callback function for each item. Note that this will simply\ndelegate to the native Array.prototype.forEach method if supported. It doesn't support stopping the\niteration by returning false in the callback function like each. However, performance\ncould be much better in modern browsers comparing with each

\n

Parameters

  • array : Array

    The array to iterate

    \n
  • fn : Function

    The callback function.

    \n

    Parameters

    • item : Object

      The item at the current index in the passed array

      \n
    • index : Number

      The current index within the array

      \n
    • allItems : Array

      The array itself which was passed as the first argument

      \n
  • scope : Object (optional)

    The execution scope (this) in which the specified function is executed.

    \n
Ext.Array
view source
( Object value, [Boolean newReference] ) : Array
Converts a value to an array if it's not already an array; returns:\n\n\nAn empty array if given value is undefined or n...

Converts a value to an array if it's not already an array; returns:

\n\n
    \n
  • An empty array if given value is undefined or null
  • \n
  • Itself if given value is already an array
  • \n
  • An array copy if given value is iterable (arguments, NodeList and alike)
  • \n
  • An array with one item which is the given value, otherwise
  • \n
\n\n

Parameters

  • value : Object

    The value to convert to an array if it's not already is an array

    \n
  • newReference : Boolean (optional)

    True to clone the given array and return a new reference if necessary,\ndefaults to false

    \n

Returns

Ext.Array
view source
( Array array, Object item )
Push an item into the array only if the array doesn't contain it yet ...

Push an item into the array only if the array doesn't contain it yet

\n

Parameters

  • array : Array

    The array

    \n
  • item : Object

    The item to include

    \n
Ext.Array
view source
( Array array, Object item, [Number from] ) : Number
Get the index of the provided item in the given array, a supplement for the\nmissing arrayPrototype.indexOf in Interne...

Get the index of the provided item in the given array, a supplement for the\nmissing arrayPrototype.indexOf in Internet Explorer.

\n

Parameters

  • array : Array

    The array to check

    \n
  • item : Object

    The item to look for

    \n
  • from : Number (optional)

    The index at which to begin the search

    \n

Returns

  • Number

    The index of item in the array (or -1 if it is not found)

    \n
Ext.Array
view source
( Array array, Number index, Array items ) : Array
Inserts items in to an array. ...

Inserts items in to an array.

\n

Parameters

  • array : Array

    The Array in which to insert.

    \n
  • index : Number

    The index in the array at which to operate.

    \n
  • items : Array

    The array of items to insert at index.

    \n

Returns

Ext.Array
view source
( Array array1, Array array2, Array etc ) : Array
Merge multiple arrays into one with unique items that exist in all of the arrays. ...

Merge multiple arrays into one with unique items that exist in all of the arrays.

\n

Parameters

Returns

Ext.Array
view source
( Array array, Function fn, Object scope ) : Array
Creates a new array with the results of calling a provided function on every element in this array. ...

Creates a new array with the results of calling a provided function on every element in this array.

\n

Parameters

  • array : Array
    \n
  • fn : Function

    Callback function for each item

    \n
  • scope : Object

    Callback function scope

    \n

Returns

Ext.Array
view source
( Array/NodeList array, [Function comparisonFn] ) : Object
Returns the maximum value in the Array. ...

Returns the maximum value in the Array.

\n

Parameters

  • array : Array/NodeList

    The Array from which to select the maximum value.

    \n
  • comparisonFn : Function (optional)

    a function to perform the comparision which determines maximization.\nIf omitted the \">\" operator will be used. Note: gt = 1; eq = 0; lt = -1

    \n

Returns

  • Object

    maxValue The maximum value

    \n
Ext.Array
view source
( Array array ) : Number
Calculates the mean of all items in the array. ...

Calculates the mean of all items in the array.

\n

Parameters

  • array : Array

    The Array to calculate the mean value of.

    \n

Returns

Ext.Array
view source
( Array array1, Array array2, Array etc ) : Array
Merge multiple arrays into one with unique items. ...

Merge multiple arrays into one with unique items.

\n\n

union is alias for merge

\n

Parameters

Returns

Ext.Array
view source
( Array/NodeList array, [Function comparisonFn] ) : Object
Returns the minimum value in the Array. ...

Returns the minimum value in the Array.

\n

Parameters

  • array : Array/NodeList

    The Array from which to select the minimum value.

    \n
  • comparisonFn : Function (optional)

    a function to perform the comparision which determines minimization.\nIf omitted the \"<\" operator will be used. Note: gt = 1; eq = 0; lt = -1

    \n

Returns

  • Object

    minValue The minimum value

    \n
Ext.Array
view source
( Array/NodeList array, String propertyName ) : Array
Plucks the value of a property from each item in the Array. ...

Plucks the value of a property from each item in the Array. Example:

\n\n
Ext.Array.pluck(Ext.query(\"p\"), \"className\"); // [el1.className, el2.className, ..., elN.className]\n
\n

Parameters

  • array : Array/NodeList

    The Array of items to pluck the value from.

    \n
  • propertyName : String

    The property name to pluck from each element.

    \n

Returns

  • Array

    The value from each item in the Array.

    \n
Ext.Array
view source
( Array target, Object... elements ) : Array
Pushes new items onto the end of an Array. ...

Pushes new items onto the end of an Array.

\n\n

Passed parameters may be single items, or arrays of items. If an Array is found in the argument list, all its\nelements are pushed into the end of the target Array.

\n

Parameters

  • target : Array

    The Array onto which to push new items

    \n
  • elements : Object...

    The elements to add to the array. Each parameter may\nbe an Array, in which case all the elements of that Array will be pushed into the end of the\ndestination Array.

    \n

Returns

  • Array

    An array containing all the new items push onto the end.

    \n
Ext.Array
view source
( Array array, Object item ) : Array
Removes the specified item from the array if it exists ...

Removes the specified item from the array if it exists

\n

Parameters

  • array : Array

    The array

    \n
  • item : Object

    The item to remove

    \n

Returns

  • Array

    The passed array itself

    \n
Ext.Array
view source
( Array array, Number index, Number removeCount, [Array insert] ) : Array
Replaces items in an array. ...

Replaces items in an array. This is functionally equivalent to the splice method\nof Array, but works around bugs in IE8's splice method and is often more convenient\nto call because it accepts an array of items to insert rather than use a variadic\nargument list.

\n

Parameters

  • array : Array

    The Array on which to replace.

    \n
  • index : Number

    The index in the array at which to operate.

    \n
  • removeCount : Number

    The number of items to remove at index (can be 0).

    \n
  • insert : Array (optional)

    An array of items to insert at index.

    \n

Returns

Ext.Array
view source
( Array array, Number begin, Number end ) : Array
Returns a shallow copy of a part of an array. ...

Returns a shallow copy of a part of an array. This is equivalent to the native\ncall \"Array.prototype.slice.call(array, begin, end)\". This is often used when \"array\"\nis \"arguments\" since the arguments object does not supply a slice method but can\nbe the context object to Array.prototype.slice.

\n

Parameters

  • array : Array

    The array (or arguments object).

    \n
  • begin : Number

    The index at which to begin. Negative values are offsets from\nthe end of the array.

    \n
  • end : Number

    The index at which to end. The copied items do not include\nend. Negative values are offsets from the end of the array. If end is omitted,\nall items up to the end of the array are copied.

    \n

Returns

  • Array

    The copied piece of the array.

    \n
Ext.Array
view source
( Array array, Function fn, Object scope ) : Boolean
Executes the specified function for each array element until the function returns a truthy value. ...

Executes the specified function for each array element until the function returns a truthy value.\nIf such an item is found, the function will return true immediately. Otherwise, it will return false.

\n

Parameters

  • array : Array
    \n
  • fn : Function

    Callback function for each item

    \n
  • scope : Object

    Callback function scope

    \n

Returns

  • Boolean

    True if the callback function returns a truthy value.

    \n
Ext.Array
view source
( Array array, [Function sortFn] ) : Array
Sorts the elements of an Array. ...

Sorts the elements of an Array.\nBy default, this method sorts the elements alphabetically and ascending.

\n

Parameters

  • array : Array

    The array to sort.

    \n
  • sortFn : Function (optional)

    The comparison function.

    \n

Returns

Ext.Array
view source
( Array array, Number index, Number removeCount, Object... elements ) : Array
Replaces items in an array. ...

Replaces items in an array. This is equivalent to the splice method of Array, but\nworks around bugs in IE8's splice method. The signature is exactly the same as the\nsplice method except that the array is the first argument. All arguments following\nremoveCount are inserted in the array at index.

\n

Parameters

  • array : Array

    The Array on which to replace.

    \n
  • index : Number

    The index in the array at which to operate.

    \n
  • removeCount : Number

    The number of items to remove at index (can be 0).

    \n
  • elements : Object...

    The elements to add to the array. If you don't specify\nany elements, splice simply removes elements from the array.

    \n

Returns

  • Array

    An array containing the removed items.

    \n
Ext.Array
view source
( Array array ) : Number
Calculates the sum of all items in the given array. ...

Calculates the sum of all items in the given array.

\n

Parameters

  • array : Array

    The Array to calculate the sum value of.

    \n

Returns

Ext.Array
view source
( Object iterable, [Number start], [Number end] ) : Array
Converts any iterable (numeric indices and a length property) into a true array. ...

Converts any iterable (numeric indices and a length property) into a true array.

\n\n
function test() {\n    var args = Ext.Array.toArray(arguments),\n        fromSecondToLastArgs = Ext.Array.toArray(arguments, 1);\n\n    alert(args.join(' '));\n    alert(fromSecondToLastArgs.join(' '));\n}\n\ntest('just', 'testing', 'here'); // alerts 'just testing here';\n                                 // alerts 'testing here';\n\nExt.Array.toArray(document.getElementsByTagName('div')); // will convert the NodeList into an array\nExt.Array.toArray('splitted'); // returns ['s', 'p', 'l', 'i', 't', 't', 'e', 'd']\nExt.Array.toArray('splitted', 0, 3); // returns ['s', 'p', 'l']\n
\n\n

Ext.toArray is alias for Ext.Array.toArray

\n

Parameters

  • iterable : Object

    the iterable object to be turned into a true Array.

    \n
  • start : Number (optional)

    a zero-based index that specifies the start of extraction. Defaults to 0

    \n
  • end : Number (optional)

    a 1-based index that specifies the end of extraction. Defaults to the last\nindex of the iterable value

    \n

Returns

Ext.Array
view source
( Object array, Object getKey, Object scope )
Creates a map (object) keyed by the elements of the given array. ...

Creates a map (object) keyed by the elements of the given array. The values in\nthe map are the index+1 of the array element. For example:

\n\n
 var map = Ext.Array.toMap(['a','b','c']);\n\n // map = { a: 1, b: 2, c: 3 };\n
\n\n

Or a key property can be specified:

\n\n
 var map = Ext.Array.toMap([\n         { name: 'a' },\n         { name: 'b' },\n         { name: 'c' }\n     ], 'name');\n\n // map = { a: 1, b: 2, c: 3 };\n
\n\n

Lastly, a key extractor can be provided:

\n\n
 var map = Ext.Array.toMap([\n         { name: 'a' },\n         { name: 'b' },\n         { name: 'c' }\n     ], function (obj) { return obj.name.toUpperCase(); });\n\n // map = { A: 1, B: 2, C: 3 };\n
\n

Parameters

Ext.Array
view source
( Array array1, Array array2, Array etc ) : Array
Merge multiple arrays into one with unique items. ...

Merge multiple arrays into one with unique items.

\n\n

union is alias for merge

\n

Parameters

Returns

Ext.Array
view source
( Array array ) : Array
Returns a new array with unique items ...

Returns a new array with unique items

\n

Parameters

Returns

","subclasses":[],"name":"Ext.Array","alternateClassNames":[],"inheritdoc":null,"files":[{"href":"Array2.html#Ext-Array","filename":"Array.js"}],"html_meta":{"author":null,"docauthor":null},"singleton":true,"id":"class-Ext.Array","statics":{"property":[],"event":[],"css_var":[],"method":[],"css_mixin":[],"cfg":[]},"requires":[]});