Вопрос

I have this usecase:

  1. I get all of my Customers.
  2. For each Cutomer, I want to get his Receipt.
  3. For each Receipt, I want to get all ShoppingItems.

From the examples I can see how TreeGrid works if I had a hierarchy of objects of the same type, but I don't know how this would work with my usecase. Of course, if there's a better component to show this kind of data/connections, that would be good too :)

Это было полезно?

Решение

You can use the Tree (the model behind the TreeGrid) in Parent mode. When you build you Tree from the data you receive from the server You can add attribute to each node saying this node is of Customer type, this one has Customer1 as a parent and is of Receipt type. Another will be node with Receipt1 as parent and with ShoppingItems type. When you build you Tree from the data you receive from the server you can in the same time you are setting the type attribute set the icon of the node to reflect the type of your element. Up to you to set such node as folder or not (for example Customers, Receipt will be folders but ShoppingItems not and will be just a leaf). Hope It could help

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top