react-dnd-treeview icon indicating copy to clipboard operation
react-dnd-treeview copied to clipboard

Search

Open aslanalyiev opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. Sometimes it is hard to implement a search with nested folders

Describe the solution you'd like It would be cool to implement a search option from the box

aslanalyiev avatar Apr 12 '23 10:04 aslanalyiev

@aslanalyiev I'm not sure what the UI image is for filtering a tree view by search, do you have a specific image?

Or do you have any references?

minop1205 avatar Apr 12 '23 12:04 minop1205

I meant to provide a prop where a user can put a string and TreeComponent will automatically filter data(nested as well)

const treeDataWithALotOfNestedChildren = [....];

const searchText = 'name of some element from the tree data'; //some string that a user provided to find needed the tree elements

<Tree
   tree={treeDataWithALotOfNestedChildren}
   ...requiredProps
   searchQuery={searchText}
/>

result:

New filtered tree with the preservation of the structure(e.g. if a deeply nested child has a lot of parents that don't meet searchText they also should be rendered).

initialTree:

titleR
  title2
     title3
titleR2

searchText = title3

result:

titleR
  title2
     title3

smth like that :)

aslanalyiev avatar Apr 13 '23 08:04 aslanalyiev

any update👀

1pone avatar May 07 '24 02:05 1pone