Displaying children in a grid with Dojo 1.7
-
30-05-2021 - |
Question
I'd like to display some data in a tree/grid format like so:
MasterId Title Date
DetailId
DetailId
MasterId Title Date
DetailId
where the IDs, title, and date are separate columns, and the DetailIDs are children of a MasterId. When the user clicks on a detail line, I'll perform an action. If the user sorts a column, I'd like the DetailIds to stay with their parent MasterId.
Is there a way to do this with stock Dojo components? The dojox.grid.TreeGrid looks close, but from what I can tell when you expand the children, the DetailIds will go into their own column, where I'd prefer they stay in the same column as MasterId.
If there's not an out-of-the-box way to do this, should I try subclassing a TreeGrid?
Solution
Well, it turns out that a dojox.grid.TreeGrid is what I was looking for, but I didn't know about dijit.tree.ForestStoreModel. This example does exactly what I'm trying to do:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_treegrid_model.html