This is a migrated thread and some comments may be shown as answers.

Treelist Filter Parents only

8 Answers 703 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Sanjay
Top achievements
Rank 1
Sanjay asked on 11 Jul 2016, 10:01 AM

Hi,

I need Treelist Filter to show Parent row along with all its child nodes. Is this possible?

Appreciate any help.

 

Thanks,
Sanjay

8 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 11 Jul 2016, 11:52 AM

Hello Sanjay,

 

Here is how current filter functionality works:

 1. Filter descriptors are applied against all data items

 2. Then for each node the path back to the root node is rebuild, so that the node can be visualized in the TreeList.

 

There aren't other filter behaviors supported.

 

Regards,
Nikolay Rusev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Sanjay
Top achievements
Rank 1
answered on 11 Jul 2016, 11:55 AM
Thanks
0
Ridwan
Top achievements
Rank 1
answered on 24 Apr 2020, 01:43 AM
is this feature possible today?
0
Tsvetomir
Telerik team
answered on 27 Apr 2020, 03:05 PM

Hi Ridwan,

The filtering of the TreeList would return only the items that match the respective filter expression. In case the items that pass the filtering are nested, all of their parents until the root element are visualized. In case items with values that do not match the filter expression are shown, it would be unexpected.

Is there a specific functionality you are willing to achieve? Sharing more details on the use-case would be very helpful to me.

 

Regards,
Tsvetomir
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Tawab
Top achievements
Rank 1
answered on 07 Jul 2020, 07:34 PM

Similar to the previous posters, the TreeList column filter does not work for me as expected.  It is returning parent rows that don't match the filter.  I can sort of understand why it would behave this way.  However, for my use case I cannot use it like this and so I'm having to discard the TreeList and switch to using a regular Grid. If there is no update or workaround for the filter behavior, then documenting this limitation up front may save someone else some time. :)

0
Tsvetomir
Telerik team
answered on 09 Jul 2020, 11:19 AM

Hi, Tawab,

Thank you for sharing your feedback! I will consider updating the relevant article with more details on the exact mechanism of the filtering in the context of the TreeList widget. 

 

Best regards,
Tsvetomir
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jamie
Top achievements
Rank 1
Veteran
answered on 22 Oct 2020, 11:09 AM

I know this post is old but I came across it needing essentially the same solution (I wanted a filter to include the child nodes of matched items).  I came up with a solution to do this so figured I'd share in case anyone else stumbles on this.

First, I created a custom checkbox filter list using the solution Telerik provided to this post (https://www.telerik.com/forums/checkbox-filtering-in-treelist#yXyT2Xl0S0q9lXGm8GIzVA).  You might be able to do this workaround without doing the checkbox filter but I would assume it's easier to do this and some of the code in that solution is what led me to make it work so at a minimum you'd need to do a custom solution that captured the submit button of the filter page and manually applied the filters as shown in this example.

Once I got that custom solution working and therefore was manually applying filters after capturing the click event of the filter submit button, I then did my work around to include child nodes.  To explain this better I'll start by saying that in my case I was trying to do my filter based on the Title of the item (which is the field that was in the left nested column).  I created another field in my data called SearchTitle that had a semi colon delimited aggregation of all the titles in it's parent structure inclusively from the top to it.

Example, if I had a parent title of "Task 1" with a child of "Sub Task 1" and a child under that of "Response 1" then the SearchTitle field for Task 1 would be "Task 1", for Sub Task 1 would be "Task 1; Sub Task 1", and for Response 1 it would be "Task 1; Sub Task 1; Response 1".

I then modified my custom filter so that when I applied a filter to the title field in the actual TreeList, the code actually applied the filter to the SearchTitle field instead and I used the "contains" operator for my filters.  That way if I search for "Sub Task 1" it would show me Sub Task 1 and Response 1 because both records would match.

You'll also have to capture the filter clear button (the initial example doesn't do that) and remove the filters manually (using the function created in the initial example).

Sorry I can't show code or give better details/examples but hopefully this helps someone get going in the right direction if they find this post.

Also, this solution isn't perfect ;the big glaring issue is that since we're using the "contains" operator and doing so on an aggregated list of all parent's, there's a chance that you'll get back records in your filter that you don't actually want depending on the content of your data (if I had two titles called "Awesome" and "Super Awesome", filtering for "Awesome" would also include "Super Awesome" whether I wanted it or not).  In my use case my titles had a unique numbering in them so I didn't have this problem.

0
Alex Hajigeorgieva
Telerik team
answered on 26 Oct 2020, 09:51 AM

Hello, Jamie,

Thank you very much for the shared solution.

I would like to add that for complete control over the filtering result set, the dataSource serverFiltering can be enabled:

https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/serverfiltering

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TreeList
Asked by
Sanjay
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Sanjay
Top achievements
Rank 1
Ridwan
Top achievements
Rank 1
Tsvetomir
Telerik team
Tawab
Top achievements
Rank 1
Jamie
Top achievements
Rank 1
Veteran
Alex Hajigeorgieva
Telerik team
Share this question
or