Treelist filtering

1 Answer 126 Views
TreeList
ted
Top achievements
Rank 1
Iron
ted asked on 03 Aug 2022, 09:02 PM

I'm following the example for using a treelist

https://www.telerik.com/kendo-react-ui/components/treelist/

One thing I noticed is when I enter a filter term, the match result could be hidden/collapsed in the child of a displayed parent. Is there a good way to auto expand out and highlight the matched rows?

 

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 05 Aug 2022, 04:04 PM

Hello ted,

Setting the `[expandField]` of the filtered items to `true` will allow you to expand all visible nodes:

  const addExpandField = (dataTree) => {
    const expanded = state.expanded;
    return mapTree(dataTree, subItemsField, (item) =>
      extendDataItem(item, subItemsField, {
        [expandField]: true, //expanded.includes(item.id)
      })
    );
  };

You can test it here: 

https://stackblitz.com/edit/react-cfzeqy?file=app%2Fmain.jsx

Regards,
Vessy
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Tags
TreeList
Asked by
ted
Top achievements
Rank 1
Iron
Answers by
Vessy
Telerik team
Share this question
or