Author Topic: Search feature instead of filter in Treegrid  (Read 1560 times)

Rasith

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 10
    • View Profile
Search feature instead of filter in Treegrid
« on: July 23, 2021, 12:57:12 pm »
Hi,

In my treegrid I want to be able to search for items by typing partial string into the header text field just like the filter feature.

https://paramquery.com/pro/demos/treegrid

Expectation,
1. Matched items to be highlighted and the first match to be scrolled to so that it is visible.
2. None of the items in the tree should be hidden unlike how it works in filter feature.  Basically, the original tree items should remain intact.  We should just scroll to the match rows.
3. Ability to navigate to next and previous matches if there are multiple matching rows.

The reason why filter doesn't work for me and I want the "Search" feature is because, I would want to search based on a parent node/row text but then really interact with the children of that searched/matching parent.  So, I want the children of the matching row to also be visible.  Currently, in the filter feature, the children/descendants of the matched row are not shown.

Is there someway to achieve this?  Please help.

Thank you

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Search feature instead of filter in Treegrid
« Reply #1 on: July 23, 2021, 02:26:29 pm »
Quote
Currently, in the filter feature, the children/descendants of the matched row are not shown.

It seems you are not fully familiar with filter feature of pqgrid, please check this demo to show children of matched rows.

https://paramquery.com/pro/demos/treegrid_filter

Rasith

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Search feature instead of filter in Treegrid
« Reply #2 on: July 27, 2021, 11:50:33 pm »
Hi,

I checked your demo and it works as stated by you.  However, in my application, the child items of the matching item are not shown.  Only tree upto the matching item is shown even though there are child items of the matching item.  Could this be because of any specific configuration/setting?  Please let me know.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Search feature instead of filter in Treegrid
« Reply #3 on: July 28, 2021, 09:34:24 am »
Please recheck the demo. Required configuration setting treeModel.filterShowChildren is explained in the demo itself.

Also check the API of treeModel.

https://paramquery.com/pro/api#option-treeModel