each(function, scope)
each(function, scope)
Executes the specified function once for every item in the collection.
Parameters:
-
function: the function to execute for each item. The function should return a boolean value. Returningfalsefrom the function will stop the iteration. The following arguments are passed to the function:-
item(mixed): the collection item -
index(number): the item's index -
length(number): total number of items in the collection
-
-
scope(Object): (optional) scope in which to execute the function.
Example:
Iterate through a collection of action buttons or grid rows:
panel.actions.each(function(action) {
action.enable(!action.enabled);
});
panel.gridRows.each(function(row) {
var action = row.actions.get(0);
action.enable(!action.enabled);
});
