3.5.2.1.49. 树形数据网格

在线示例

TreeDataGrid, 类似于DataGrid组件,用于显示和排序表格式数据,并提供显示层级结构数据和操作行列的方法,这些行和列由于只在滚动时按需加载数据,因而性能更好。

该组件用于显示具自引用关系的实体。例如,它可以用于展示文件系统或公司组织结构图。

gui TreeDataGrid

该组件对应的 XML 名称: treeDataGrid

对于 TreeDataGrid,应该设置两个属性:dataContainer,它将 treeDataGrid 绑定到数据容器hierarchyProperty,它是引用同一实体的实体属性的名称。

在界面 XML 描述中定义的组件示例:

  1. <data readOnly="true">
  2. <collection id="departmentsDc" class="com.company.sales.entity.Department" view="department-view">
  3. <loader id="departmentsDl">
  4. <query>
  5. <![CDATA[select e from sales_Department e]]>
  6. </query>
  7. </loader>
  8. </collection>
  9. </data>
  10. <layout>
  11. <treeDataGrid id="treeDataGrid" dataContainer="departmentsDc" hierarchyProperty="parentDept">
  12. <columns>
  13. <column id="name" property="name"/>
  14. <column id="parentDept" property="parentDept"/>
  15. </columns>
  16. </treeDataGrid>
  17. </layout>

TreeDataGrid 的功能类似于简单的DataGrid


treeDataGrid 的属性

align - caption - captionAsHtml - colspan - columnResizeMode - columnsCollapsingAllowed - contextMenuEnabled - css - dataContainer - datasource - description - descriptionAsHtml - editorBuffered - editorCancelCaption - editorEnabled - editorSaveCaption - enable - box.expandRatio - frozenColumnCount - headerVisible - height - hierarchyProperty - icon - id - reorderingAllowed - responsive - rowspan - selectionMode - settingsEnabled - sortable - stylename - tabIndex - textSelectionEnabled - visible - width
treeDataGrid 的元素

actions - buttonsPanel - columns - rowsCount
column 的属性

caption - collapsed - collapsible - collapsingToggleCaption - editable - expandRatio - id - maximumWidth - minimumWidth - property - resizable - sortable - width
column 的元素

formatter
API

addGeneratedColumn - applySettings - createRenderer - editItem - saveSettings - getColumns - setDescriptionProvider - setCellStyleProvider - setConverter - setDetailsGenerator - setEnterPressAction - setItemClickAction - setRenderer - setRowDescriptionProvider - setRowStyleProvider - sort
树形数据网格的监听器

ColumnCollapsingChangeListener - ColumnReorderListener - ColumnResizeListener - ContextClickListener - EditorCloseListener - EditorOpenListener - EditorPostCommitListener - EditorPreCommitListener - ItemClickListener - SelectionListener - SortListener