TreeDataGrid

TreeDataGrid is a hybrid component that combines the power and flexibility of DataGrid with the hierarchical structure of Tree. The component is used for entities that have references to themselves. For example, it can be a product catalog structure or a company organization chart.

Component’s XML-name: treeDataGrid.

Basics

TreeDataGrid primarily replicates the functionality of the DataGrid component.

A typical tree data grid is shown below:

tree data grid

The dataContainer attribute of the TreeDataGrid component should contain a reference to a collection container.

The hierarchyProperty attribute defines the name of the entity attribute, which refers to the same entity.

Below is an example of component description in a screen XML descriptor:

<data>
    <collection id="departmentsDc" class="ui.ex1.entity.Department">
        <fetchPlan extends="_base">
            <property name="parentDept" fetchPlan="_base"/>
            <property name="manager"/>
        </fetchPlan>
        <loader id="departmentsDl">
            <query>
                <![CDATA[select e from uiex1_Department e]]>
            </query>
        </loader>
    </collection>
</data>
<layout>
    <treeDataGrid id="departmentsDataGrid"
                  hierarchyProperty="parentDept"
                  width="100%"
                  dataContainer="departmentsDc">
        <columns>
            <column id="name" property="name"/>
            <column id="manager" property="manager"/>
        </columns>
    </treeDataGrid>
</layout>

Events and Handlers

To generate a handler stub in Jmix Studio, select the component in the screen descriptor XML or in the Component Hierarchy panel and use the Handlers tab of the Component Inspector panel.

Alternatively, you can use the Generate Handler button in the top panel of the screen controller.

CollapseEvent

ColumnCollapsingChangeEvent

ColumnReorderEvent

ColumnResizeEvent

ContextClickEvent

EditorCloseEvent

EditorOpenEvent

EditorPostCommitEvent

EditorPreCommitEvent

ExpandEvent

ItemClickEvent

SelectionEvent

SortEvent

See SortEvent.

ContextHelpIconClickHandler

DetailsGenerator

LookupSelectHandler

RowDescriptionProvider

RowStyleProvider

All XML Attributes

You can view and edit attributes applicable to the component using the Component Inspector panel of the Studio’s Screen Designer.

TreeDataGrid XML Elements

Columns XML Attributes

Aggregation XML Attributes

Aggregation XML Element