Hi,
I’m using a richselect view to filter values of tree table. The lower level values are populating correctly, but the sums at level 1 are not changing based on selection. Please advise.
https://snippet.webix.com/p6ncgpzi
Hi, @tnad0073 !
You can calculate subtotals in a template with eachSubItem
function:
template:function(obj, common) {
if (obj.$group) {
if (obj.$count) { //has child items
let sum = 0;
$$('tree1').data.eachSubItem(obj.id, function (child) {
if (child.spend) sum += child.spend;
});
return sum;
}
}
return obj.spend;
}
Please, check the snippet: Code Snippet