Set Filter of Grid column from selection of TreeView

1 Answer 121 Views
Grid TreeView
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Bernd asked on 03 Nov 2021, 09:42 AM

Hi.

I have setup the Grid component with data from an API call and that all works pretty well. I have also setup a TreeView with data that basically shows locations (states and cities). Also one of the columns in my Grid shows cities.

What I want to achieve is if a user selects a City in the TreeView component, the filter of the Grid Column of the city field should be set to the selected city of the treeview. I know I can use the TreeViewItemClickEvent to handle the clicked item in the TreeView but I am not sure how to put the text of the selected treeview Item into the filter box of the Grid Component. Can you please point me in to the right direction or maybe even have an example on how to do this?

Thanks!

1 Answer, 1 is accepted

Sort by
1
Accepted
Konstantin Dikov
Telerik team
answered on 03 Nov 2021, 11:00 AM

Hello Bernd,

You can take a look at the following help topic for filtering the Grid and the exact structure of the filter expression:

For the requirement that you have, you can use the DataState and update it with a new filter expression accordingly when a new selection from the outside component is made. For your convenience, I have made a simple example that uses a DropDownList to create filter expression for the Grid:

Hope this helps.

 

Regards,
Konstantin Dikov
Progress Telerik

Remote troubleshooting is now easier with Telerik Fiddler Jam. Get the full context to end-users' issues in just three steps! Start your trial here - https://www.telerik.com/fiddler-jam.
Tags
Grid TreeView
Asked by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Konstantin Dikov
Telerik team
Share this question
or