executes a defined function for each element of an array
The PowerArray mixin will be removed in Webix 7.0
functor | function | the function that needs executing |
master | object | optional, the value to be passed as the this parameter |
var data = webix.toArray(grid_data);
// default
data.each(function(obj){
console.log(this.length) // the function is applied to the array itself
});
// binding to the datatable
webix.ui({
view:"datatable",
id:"grid",
autoConfig:true
});
data.each(function(obj){
if (obj.id%2 == 0)
this.add(obj)
}, $$("grid")); // the function is applied to the bound datatable
In the first example the defined function is applied to the data array of data objects. In the second example the defined function is applied to a grid view that is bound to the data array.