components icon indicating copy to clipboard operation
components copied to clipboard

[Tree][NestedTreeDataSource] filter doesn't work

Open fransdeboer opened this issue 2 months ago โ€ข 1 comments

Provide a general summary of the issue here

We need to implement a search funtion for a lazy loaded tree, see the screenshot.

However the addFilter method of NestedTreeDataSource doesn't work and throws an not implemented error

Uncaught Error: Filtering is not yet supported in tree data sources.
    at NestedTreeDataSource.addFilter (tree-data-source.js:40:11)
    at SubjectSelection.search_fn (subject-selection.ts:318:24)
Image

๐Ÿค” Expected Behavior?

NestedTreeDataSource should support filters.

๐Ÿ˜ฏ Current Behavior

๐Ÿ’ Possible Solution

๐Ÿ–ฅ๏ธ Steps to Reproduce

    this.dataSource = new NestedTreeDataSource(data, { ... });

    if (detail) {
      const regex = new RegExp(detail, 'i');
      this.dataSource?.addFilter('search', (item: LazyNestedDataNode) => regex.test(item.name));
    } else {
      this.dataSource?.removeFilter('search');
    }

    this.dataSource?.update();

What browsers are you seeing the problem on? (only for bugs in code)

Safari, Chrome

If other, please specify.

No response

What operating system are you using?

WSL

๐Ÿ‘ค Your name

Frans de Boer

๐Ÿงข Your product/team

Magister

๐ŸŽจ Your Theme(s)

Magister

fransdeboer avatar Oct 31 '25 10:10 fransdeboer

Probably a duplicate of #2749

jpzwarte avatar Oct 31 '25 10:10 jpzwarte