Update treetable totals when figures change in cell

How does one update the treetable header row total/s after the figure in a cell is edited and changed?

Managed to work it out. Code is place in onAfterEditStop method.

var difference = state.value - state.old;
var parentId = “”;
var parentRecord = “”;
var currentValue = 0;

//Update parent
do {
parentId = parentId == “” ? this.getParentId(editor.row) : this.getParentId(parentId);
parentRecord = this.getItem(parentId);
currentValue = parentRecord[editedDay];
parentRecord[editedDay] = currentValue + difference;
}
while (parentRecord.$level > 1);

.