0

I'm trying te play with TreeGrid at Vaadin 8.1 RC1. I'm trying to migare from HierarchicalContainer to the TreeDataProvider. But I didn't get the idea of the new Hierarchial data stucture. I need just some simple things: - Is it possible to get an id of any item of the Hierarchical data? Or new data will not use Ids? - is is possible to get parent object of existed object. Like

TreeData<MyClass> MyTreeData;
MyClass  myObject;
MyClass parentItem = MyTreeData.getParent(myObject)

I've found some deail related to HierarchicalQuery and "The parent node is available in the HierarchicalQuery via the getParent method, which returns for the root level." But no examples how to use HierarchicalQuery.

Márton
  • 105
  • 10
svartalf
  • 11
  • 2
  • Seems like the `TreeGrid` component doesn't need the parent information in a `HierarchicalDataProvider`. It is indirectly defined by the `fetchChildren` method. How did you find out the parent in Vaadin 7? – Steffen Harbich Jul 26 '17 at 10:37
  • I choose to store the hierarchy in my own domain objects, instead of relying on the helper classes of Vaadin. There is https://github.com/vaadin/framework/issues/9700 and a patch in review providing TreeData.getParent() for the cases using a TreeDataProvider, but an enhancement request for the generic case of any hierarchical data provider would still be welcome. – svartalf Jul 26 '17 at 14:01
  • So I guess you need to implement your own `HierachicalDataProvider` that uses your domain objects. But maybe I don't get your question. – Steffen Harbich Jul 27 '17 at 07:18

1 Answers1

1

At this moment (Vaadin 8.1.0) no such method. It was added as proposal and can be implementer at future versions. We can store Hierarchical info at you bean class we use with TreeData.

svartalf
  • 11
  • 2