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.