The last time I added a derived column to a tree grid about a year ago (in this app), it was not a straightforward task and I had to use brute force and overrides to get the desired result.
The general approach was this:
1. Calculate the "derived field(s)" and add them to the models on the store load event (note that this is fired every time a treegrid node is expanded and may contain many different record types).
For example:
gridBoardStore.on('load', this._updateDerivedFields, this);
In the _updateDerivedFields method, make your calculation and add it to the model.
_updateDerivedFields: function(records){
_.each(records, function(r){
r.set('myDerivedField', someValue);
});
}
Or see the updateDerivedColumns method in src\javascript\app.js file at the link provided below for an example.
2. There were several overrides I had to make in the treegrid to prevent these fields (and columns) from being removed from the treeStore and treegrid when the grid is refreshed. See the src\javascript\utils\overrides.js file in the link provided below.
3. I added these derived columns as a separate config on the gridConfig of the gridboard (see addGridBoard function in the app.js file). The overrides in the file in #2 mentioned above also takes care of making sure these columns don't get filtered out. In the case of the example file, these columns were not available in the field picker and were always rendered.
I hope this helps. morky01 may know of a more elegant approach.
Kristy