Grid as a tree: any idea when?

I am glad this could help Enkara. I will update the instruction and use your example but could you please help me on that: how did you fill the container
// Fill container
{ … }
Because as I said allthough I have built a full ERP on
FOC framework
which uses Vaadin, I use my own implementitons of Container/Item/Property so no experience in this native part.
Thanks

My case is a little bit special also, but I’ll try to give an example, which completes the example above:

List<Person> listPeople = getListPeople();

List<Person> children = new ArrayList<>();
listPeople.forEach(person -> {
   if (isParent(person))
   {
      String parentRowId = person.getPassportNum();
      addItem(person, parentRowId);
      container.setChildrenAllowed(parentRowId, false);
   }
   else
      children.add(person);
});

children.forEach(child -> {
   String parentRowId = child.getParentPassportNum();
   container.setChildrenAllowed(parentRowId, true);
   String childRowId = child.getPassportNum();
   addItem(child, childRowId);
   container.setParent(childRowId, parentRowId);
   container.setChildrenAllowed(childRowId, false);
});

private void addItem (Person person, Object id)
{
   Item item = container.addItem(id);
   item.getItemProperty("passportNum").setValue(person.getPassportNum());
   item.getItemProperty("name").setValue(person.getName());
   item.getItemProperty("surname").setValue(person.getSurname());
}

Hi Antoine,

I met a new problem with the everprotreetable. When creating the table it is necessary to enter the propertyIdForItemIdValue, but my table doesn’t have any column that can be an id, only a combination of properties would get a unique id for the row.
Is there a way to solve that?

The only way I can think of to solve it is to have an extra column with a (generated) unique value and hide that column, but I don’t know if I’m missing something and it’s simpler than that.

Thanks again

Hi all,

Glad to announce that we just published initial release of hierarchy support for Grid as an addon:

https://vaadin.com/addon/vaadin-treegrid

This is add-on for Vaadin 7 now, but we will have this work migrated to Vaadin 8 later.

Thanks Sami. I wish you had said it one month before.You release it just after spending too many hours to get my own working solution :frowning:
Is it possible to add inbuilt filters and use ComponentRenderer addon with it?

I tried the addon in 7.7.7 and it’s not working for me. I tried the demo example and the tree renders a flat hierarchy. I appreciate if someone can help me to use this addon.

It’s working fine. I forgot to add @include treegrid; in addon.scss and in my project WidgetSet.

Thank you for this awesome addon. I hope that it will be maintained in the coming months. In fact, we are still planing to use vaadin 7 before moving to vaadin 8.

I want to add an icon to each node. Can someone help how we can achieve that ?

I manage to do that using setRenderer method and the ComponentRenderer addon.

Please note that Vaadin Framework 8.1 (about to be released) includes ComponentRenderer as well as TreeGrid and Tree components based on the new data provider APIs.