UI5 Tree Table Example

Ashley Aug 09, 2026

When it comes to displaying hierarchical or relational data in web applications, the Tree Table is an indispensable UI control. Used extensively in UI5 (User Interface development for SAP), the Tree Table offers an effective way to represent complex data structures, making navigation intuitive and user-friendly. Today, we'll explore an engaging UI5 Tree Table example that showcases its features and versatility.

SAP Design System
SAP Design System

Before diving into the example, let's briefly discuss why UI5 Tree Tables are so valuable. Tree Tables can collapse and expand rows, allowing users to drill down into data, revealing more detailed information when required. They can also display hierarchical data in an ordered, logical manner, enabling users to understand relationships between data points at a glance.

a table made out of tree stumps with a potted plant sitting on top
a table made out of tree stumps with a potted plant sitting on top

Setting Up the UI5 Tree Table

The first step in our example involves setting up the Tree Table in XML view. We'll define the_table as 'ui5:TreeTable' with the essential properties, such as columns, rows, and binding paths. Here's a simple example:

a picnic table under a tree in front of a red truck parked on the street
a picnic table under a tree in front of a red truck parked on the street

```xml ```

In this setup, we've created two columns with different screen width restrictions. The ColumnListItem is used to display data in the Tree Table row.

Defining Columns

a wooden table sitting under a tree in the grass
a wooden table sitting under a tree in the grass

Columns are defined using the Column tag, with properties like width,Aggregation, resizable, and template. For instance, to create a column displaying text:

```xml ```

Binding Data to the Tree Table

Binding data to the Tree Table is the next crucial step. We'll use JSONModel for binding. In the model's JSON, we can represent hierarchical data using objects and arrays, allowing the Tree Table to render related data.

a tree with a wooden shelf attached to it
a tree with a wooden shelf attached to it

Nested objects signify hierarchical data. For example, the following JSON structure represents a list of 'Persons', each having a 'Name' and a list of 'Hobbies':

```json { "Persons": [ { "Name": "John Doe", "Hobbies": [ "Painting", "Reading" ] }, // more persons ] } ```

Using the UI5 Tree Table for Hierarchical Data

Now, let's use our Tree Table to display this hierarchical data. We'll set the 'BindProperty' of the Tree Table to 'sap.ui.model.json.JSONModel'. We'll also need to configure the Tree Table to recognize parent-child relationships in our data by using the Hierarchy aggregation:

XYLEIA | Tree slab table cut from one single tree | Boomstamtafel uit één stam
XYLEIA | Tree slab table cut from one single tree | Boomstamtafel uit één stam

```xml ```

In this example, the 'HierarchyItem' relation 'Persons/Hobbies' tells the Tree Table to look for 'Hobbies' under each 'Person'.

Expanding and Collapsing Nodes

a wooden table surrounded by chairs under a tree
a wooden table surrounded by chairs under a tree
表格 table 展开 树
表格 table 展开 树
Olijfboom tafel
Olijfboom tafel
a wooden bench under a tree in the grass
a wooden bench under a tree in the grass
the table is made out of wood and has white chairs
the table is made out of wood and has white chairs
Spalted Walnut Wonder Table
Spalted Walnut Wonder Table
Interaction Design for Trees
Interaction Design for Trees
A wooden table around a tree.🌳 DIY backyard.🏡
A wooden table around a tree.🌳 DIY backyard.🏡
a wooden picnic table under a tree in the grass
a wooden picnic table under a tree in the grass
Forest table
Forest table
a wooden table sitting under a tree in the grass
a wooden table sitting under a tree in the grass
a table with a tree on it and a woman sitting at the top in front of it
a table with a tree on it and a woman sitting at the top in front of it
a large wooden table sitting on top of a hard wood floor
a large wooden table sitting on top of a hard wood floor
Cropped shot of a picnic table under a large tree royalty free stock images
Cropped shot of a picnic table under a large tree royalty free stock images
Tree Table
Tree Table
mesa
mesa
a wooden table that has been made to look like a tree stump with a curved edge
a wooden table that has been made to look like a tree stump with a curved edge
Wooden bench under the tree
Wooden bench under the tree
a family tree with blank labels attached to it
a family tree with blank labels attached to it
Blogger
Blogger

By default, all nodes in the Tree Table are expanded. However, users can control the expansion and collapse of nodes using the arrow icon next to the node. This behavior is enabled by the isInitiallyExpanded property set to 'false', as shown below:

```xml ```

Now that we've explored a comprehensive UI5 Tree Table example, you're well-equipped to leverage this powerful tool in your own web applications. The versatility of the Tree Table, combined with its intuitive user experience, makes it an invaluable asset to any developer's toolkit.

Now that you understand the ins and outs of UI5 Tree Tables, the possibilities are endless. So, start exploring and happy coding!