I have multiple hierarchy and I want to aggregate data for it once i edit cell in child. It is working fine for 1 level but it does not aggregate further. however, after i save data and then reload the grid. it shows as expected. Below is the code I have used in
once i finish edit on actioncomplete I refresh the grid as well.
|
import { findChildrenRecords } from '@syncfusion/ej2-treegrid';
totalChildProgress(field, data, column) {
if (!isNullOrUndefined(data.hasChildRecords)) {
//checking if the record has children
let totalUnitWeight = 0;
//using findChildrenRecords method to get deep children records and calculate sum for it
findChildrenRecords(data).map(row => {
//summing child value to show them in parent
totalUnitWeight += row['Progress'];
});
return totalUnitWeight;
}
return data.Progress;
} |
I think you have not read my question fully. it shows aggregate on all level once i save data and then reload the page.
Also, your example does not allow me to edit cell. Can you please create sample which will allow me to edit cell and based on user input. it should roll up values on all level
Parent 1____________________________________10
child 1.1_______________________________10
Child 1.1.1_________________________5
Child 1.1.2_________________________5
Hope i am clear now