We are trying to have a view where one can display the current version of a entity record and if user is interested display all of its prior versions from a audit/history table. Is this display of multiple prior records (children) possible using the TreeDataGrid? If necessary we can get both the current and history data into a single list using a view with a single column that allows a self-reference. Any pointers or sample code would help. Thanks!
If you can provide all records with self-references by a database view, the solution should be straightforward:
- Map an entity to the view. See this example: Using database view.
- Load your entity and display in the TreeDataGrid.
Hi, The main problem is, I can’t display a list of child for 1 parent with TreeDataGrid. The “hierarchyProperty” properties not let me point to the list. It can only be an object that reference to itself. So, I ended up with 1 parent - 1 child.
@krivopustov We have tried to do this and not clear how to set the hierarchyProperty to the column that had the relationship to the parent for multiple children in the same view. Basically we want to display one parent with multiple children at the same level below the parent. So one level of tree. Can you provide guidance on how to set the hierarchyProperty of the TreeDataGrid to achieve this. Thanks
Hi!
Hope this sample would help.
// Entity to display in TreeDataGrid
public class Entity {
private String name;
// ... other fields
private Entity parentEntity;
// getters/setters etc.
}
In the screen descriptor:
<treeDataGrid id="entityTable"
dataContainer="entityDc"
hierarchyProperty="parentEntity">
<columns>
...
</columns>
</treeDataGrid>
Or could you perhaps show your code samples, what exactly are you trying to do?