react-virtualized-tree icon indicating copy to clipboard operation
react-virtualized-tree copied to clipboard

Example of how to use indexSearch?

Open filburt-turle opened this issue 4 years ago • 2 comments

indexSearch: (searchTerm: string, nodes: FlattenedNode[]) => (node: FlattenedNode) => boolean;

I see the structure, but I'm wondering if someone could provide an example of a baseline version of a custom function for this prop. There's no documentation around how to use this I see the final result from this function is a boolean, but an example would clarify this better for me.

Thanks in advanced.

filburt-turle avatar Nov 15 '20 06:11 filburt-turle

I'm also a bit confused on this. I saw it was marked as required, but I have no idea what it wants for an implementation. Any guidance here?

ldeveber avatar Feb 22 '21 17:02 ldeveber

const indexByName = searchTerm => ({name}) => {
  const upperCaseName = name.toUpperCase();
  const upperCaseSearchTerm = searchTerm.toUpperCase();

  return upperCaseName.indexOf(upperCaseSearchTerm.trim()) > -1;
};

Karpengold avatar Sep 25 '22 16:09 Karpengold