groups data by the specified data property
config | object | an object with grouping parameters |
mode | boolean | defines whether the component should be re-rendered after grouping ( by default, true) |
myview.group({
by:"#company#", // 'company' is the name of data property
map:{
sales:["#sales#","sum"]
}
});
The method is called for each data item.
The config object has 2 properties:
map – an object that specifies new data properties that the items in a group will have. Properties are specified
by an array. The first element of this array is a template with a property from original data,
the second one – the functor that will be applied to all values of the property (set by the first element) in the group.
Grouping provides the following functors:
To group data initially (just after data has been loaded) you may use the scheme parameter, to be accurate, its $group key.
webix.ui({
view:"chart",
...
scheme:{
$group:{
by:"#company#", // 'company' is the name of data property
map:{
sales:["#sales#","sum"],
state:["grouped","string"]
}
}
}
});
Back to top