cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering Tree Table

Former Member
2,657

Hello to all.

I have issue with filtering data in Tree Table. I filter the data in the Tree Table using SearchField. When i load tree table i have tree of data If i find the data using a filter i can't expand this row and it looks like row without childrens, but this row contains child rows. Maybe someone faced a similar problem?

This is xml with tree table:

<SearchField
        width="100%"
        placeholder="{i18n>filterStorageBinsPlaceholder}"
        search=".onFilterStorages"/>

<table:TreeTable
        id="treeTable"
        rows="{ 
          path:'storageBins>/storageBinsTree',
          parameters: {
            arrayNames:['includedStorageBins'],
            expand: 'includedStorageBins',
            numberOfExpandedLevels: 1
          },
          events: {
            change: '.onTreeChange'
          }
        }"
        rowHeight="30"
        selectionMode="Single"
        visibleRowCount="19"
        rowSelectionChange="handleSelectRow"
        enableSelectAll="false"
        ariaLabelledBy="title">

        <table:columns>
          <table:Column width="100%">
            <Label text="{i18n>storageBin}"/>
            <table:template>
              <Text width="100%" text="{storageBins>label}"/>
            </table:template>
          </table:Column>

</table:TreeTable>

This is filter method:

onFilterStorages(oEvent) {
            const query = oEvent.getParameter("query").trim();
            this.byId("treeTable").getBinding("rows").filter(query ? new Filter({
                path: "label",
                operator: "Contains",
                value1: query
            }) : null);
}

If someone faced a similar problem, please tell me. Thank you in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

maximt
Explorer
0 Kudos

Come up with a crutch idea. Filtering hides all the rows that don't satisfy the filter condition (except for straight parents). That's a technical limitation and we can do nothing about it. But in the process of filtering (or earlier), we can add the same value of a searching attribute for all child entities and child rows will fit the filter and will be showed up.

Of course, it will be ok only if the child's attribute doesn't have its own value. In my case it saved me.

To hide the needless value is possible with writing a corresponding formatter