groups data by the specified data property
config | object | an object with grouping parameters |
target | id | the ID of the branch for multiple grouping |
myview.group({
by:"company", // 'company' is the name of a data property
map:{
sales:["sales","sum"]
}
});
The method is called for each data item.
The config object has several properties:
by – a data property according to which items will be united in groups
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 the name of 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:
missing (boolean, string) - defines how the objects the group header of which returns ""/null/false/undefined will be grouped. The possible values:
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 a data property
map:{
sales:["sales","sum"],
state:["grouped","string"]
}
}
}
});