Ext.data.JsonP.Ext_Array({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":null,"uses":[],"html":"
Files
A set of useful static methods to deal with arrays; provide missing methods for older browsers.
\nFilter through an array and remove empty item as defined in Ext.isEmpty
\n\nSee filter
\nresults
\nIterates an array or an iterable value and invoke the given callback function for each item.
\n\nvar 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\nThe iteration can be stopped by returning false in the function callback.
\n\nExt.Array.each(countries, function(name, index, countriesItSelf) {\n if (name === 'Singapore') {\n return false; // break here\n }\n});\n
\n\nExt.each is alias for Ext.Array.each
\nThe value to be iterated. If this\nargument is not iterable, the callback function is called once.
\nThe callback function. If it returns false, the iteration stops and this method returns\nthe current index
.
The item at the current index
in the passed array
The current index
within the array
The array
itself which was passed as the first argument
Return false to stop iteration.
\nThe scope (this
reference) in which the specified function is executed.
Reverse the iteration order (loop from the end to the beginning)\nDefaults false
\nSee description for the fn
parameter.
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).
\nThe Array on which to replace.
\nThe index in the array at which to operate.
\nThe number of items to remove at index.
\nThe array passed.
\nExecutes 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.
\nTrue if no false value is returned by the callback function.
\nCreates a new array with all of the elements of this array for which\nthe provided filtering function returns true.
\nresults
\nReturns the first item in the array which elicits a true return value from the\npassed selection function.
\nThe array to search
\nThe selection function to execute for each item.
\nThe array item.
\nThe index of the array item.
\nThe scope (this
reference) in which the\nfunction is executed. Defaults to the array
The first item in the array which returned true from the selection\nfunction, or null if none was found.
\nIterates 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
\nConverts a value to an array if it's not already an array; returns:
\n\nundefined
or null
The value to convert to an array if it's not already is an array
\nTrue to clone the given array and return a new reference if necessary,\ndefaults to false
\narray
\nGet the index of the provided item
in the given array
, a supplement for the\nmissing arrayPrototype.indexOf in Internet Explorer.
The array to check
\nThe item to look for
\nThe index at which to begin the search
\nThe index of item in the array (or -1 if it is not found)
\nCreates a new array with the results of calling a provided function on every element in this array.
\nresults
\nReturns the maximum value in the Array.
\nThe Array from which to select the maximum value.
\na function to perform the comparision which determines maximization.\nIf omitted the \">\" operator will be used. Note: gt = 1; eq = 0; lt = -1
\nCurrent maximum value.
\nThe value to compare with the current maximum.
\nmaxValue The maximum value
\nReturns the minimum value in the Array.
\nThe Array from which to select the minimum value.
\na function to perform the comparision which determines minimization.\nIf omitted the \"<\" operator will be used. Note: gt = 1; eq = 0; lt = -1
\nCurrent minimum value.
\nThe value to compare with the current minimum.
\nminValue The minimum value
\nPlucks the value of a property from each item in the Array. Example:
\n\nExt.Array.pluck(Ext.query(\"p\"), \"className\"); // [el1.className, el2.className, ..., elN.className]\n
\nThe Array of items to pluck the value from.
\nThe property name to pluck from each element.
\nThe value from each item in the Array.
\nPushes new items onto the end of an Array.
\n\nPassed 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.
\nThe Array onto which to push new items
\nThe 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.
\nAn array containing all the new items push onto the end.
\nReplaces 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.
\nThe Array on which to replace.
\nThe index in the array at which to operate.
\nThe number of items to remove at index (can be 0).
\nAn array of items to insert at index.
\nThe array passed.
\nReturns 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.
\nThe array (or arguments object).
\nThe index at which to begin. Negative values are offsets from\nthe end of the array.
\nThe 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.
\nThe copied piece of the array.
\nExecutes 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.
\nTrue if the callback function returns a truthy value.
\nSorts the elements of an Array.\nBy default, this method sorts the elements alphabetically and ascending.
\nThe array to sort.
\nThe comparison function.
\nAn item to compare.
\nAnother item to compare.
\nThe sorted array.
\nReplaces 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.
\nThe Array on which to replace.
\nThe index in the array at which to operate.
\nThe number of items to remove at index (can be 0).
\nThe elements to add to the array. If you don't specify\nany elements, splice simply removes elements from the array.
\nAn array containing the removed items.
\nConverts any iterable (numeric indices and a length property) into a true array.
\n\nfunction 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\nExt.toArray is alias for Ext.Array.toArray
\nthe iterable object to be turned into a true Array.
\na zero-based index that specifies the start of extraction. Defaults to 0
\na 1-based index that specifies the end of extraction. Defaults to the last\nindex of the iterable value
\narray
\nCreates 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\nOr 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\nLastly, 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
\nThe Array to create the map from.
\nName of the object property to use\nas a key or a function to extract the key.
\nValue of this inside callback.
\nThe resulting map.
\nCreates a map (object) keyed by a property of elements of the given array. The values in\nthe map are the array element. For example:
\n\n var map = Ext.Array.toMap(['a','b','c']);\n\n // map = { a: 'a', b: 'b', c: 'c' };\n
\n\nOr 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: {name: 'a'}, b: {name: 'b'}, c: {name: 'c'} };\n
\n\nLastly, 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: {name: 'a'}, B: {name: 'b'}, C: {name: 'c'} };\n
\nThe Array to create the map from.
\nName of the object property to use\nas a key or a function to extract the key.
\nValue of this inside callback.
\nThe resulting map.
\n