spotfiresoftware / spotfire-mods

Spotfire® Mods
https://spotfiresoftware.github.io/spotfire-mods/
Other
56 stars 41 forks source link

Mod data views using hierarchies #28

Open hski-github opened 3 years ago

hski-github commented 3 years ago

In the section about hierarchies it could be better described how children and rows can be used. https://tibcosoftware.github.io/spotfire-mods/docs/using-the-api/mod-data-views/#hierarchies

If I am right, you can also call rows not only on the last level (in the example "Spain"), but also already on the previous level (e.g. "Apples") and then you can all rows which are below that child ("2500" and "13500"), correct?

Would be useful to extend the example on using rows on lower level of the hierarchy. To my understanding that is actually the actual benefit of why you don't use dataView.rows(), but use dataView. hierarchy("X").root()....rows();

objerke commented 3 years ago

Hi @hski-github! Great suggestion about adding further examples regarding how hierarchies can be used.

As the documentation states, the rows() method on any DataviewHierarchyNode computes the data view rows corresponding to the sub tree of the hierarchy node. This means it can be used on any level of the hierarchy. All nodes in the hierarchy have the same methods but only leaves have a leafIndex and non leaves have an array of children