We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Search in treeview/Remove selection for parent items

Thread ID:

Created:

Updated:

Platform:

Replies:

130635 May 23,2017 05:58 AM UTC May 24,2017 10:11 AM UTC ASP.NET MVC 1
loading
Tags: TreeView
Kuntal Patel
Asked On May 23, 2017 05:58 AM UTC

Hello,

I am using the treeview control. It works fine but need to have some functionalities which i'm unable to find. I want to be able to search treeview. Is there any way by which i can achieve the same? Now a days, it's very common i think.

Apart from that, it would be nice if i can find a way by which i can only select(checkboxes) leaf nodes. In other words,any parent can't be selected.

Request you to provide any insights regarding the same.

Ashokkumar Balasubramanian [Syncfusion]
Replied On May 24, 2017 10:11 AM UTC

Hi Kuntal, 
 
Query 1: How to search the tree nodes in TreeView. 
 
Currently in our TreeView component, there is no inbuilt support to search the Tree nodes in TreeView control. We have logged this as a new feature request in our database. We will implement this feature in any of our future releases.  
But we can achieve your requirement in application level, please check the details in below help document. 
 
 
For your reference, we have prepared simple playground sample for your requirement, please check the sample in below JS Playground. 
 
 
Query 2: I can only select(checkboxes) leaf nodes, parent can't be selected. 
 
We have analyzed requirement. We could see that you have achieved this requirement using TreeView component “AutoCheck” property and “NodeCheck” event. Please refer the below code snippet. 
 
[CSHTML] 
 
@Html.EJ().TreeView("tree").Items(items => 
                { 
                    items.Add().Text("File").Children(child => 
                    { 
                        child.Add().Text("New"); 
                        child.Add().Text("Open"); 
                        child.Add().Text("Save"); 
                        child.Add().Text("Save As"); 
                        child.Add().Text("Print Preview"); 
                        child.Add().Text("Print"); 
                        child.Add().Text("Close"); 
                    });             }).ShowCheckbox(true).AutoCheck(false).ClientSideEvents(evt=>evt.NodeCheck("onNodeCheck")) 
 
[Script] 
function onNodeCheck(args) { 
     if (args.currentElement[0].childElementCount != 1) 
          this.uncheckNode(args.currentElement) 
} 
 
 For your reference, we have prepared simple sample, it can be downloaded in below location. 
 
 
Please let us know, if the provided sample is helpful for your requirement or not. 
 
Regards, 
Ashokkumar B. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;