2

I can't figure out how to make my treeview filterable.

Looking at the demos on http://demos.telerik.com/kendo-ui/treeview/api

function DoSearch() {

var treeView = $("#ItemList").kendoTreeView().data("kendoTreeView");
var filterText = $("#search-value").val();
if (filterText !== "") {
    treeView.dataSource.filter({
        field: "text",
        operator: "contains",
        value: filterText
    });
} else {
    treeview.dataSource.filter({});
}

} If I do the implementation, when using filter method I am loosing my treeview

Here a fiddle with my sample treeview the same way that I'm getting, not using datasource, the ASPNET server code return the list as appears on the fiddle, then by javascript call the kendoTreeView method.

Here's my fiddle

http://jsfiddle.net/mspasiuk/hw4j4qt2/

To put in a nutshell what I want to do is have a textbox, when I type or hit on a button using a 'contains' clause, the treeview only have to show the items who match the criteria, If the search box is empty show the original treeview.

I would appreciate any help. Thanks

mspasiuk
  • 602
  • 1
  • 7
  • 23

1 Answers1

0

Alright, I was dealing with the same issue and with the help of this post I managed to do it. So make sure you check the existing thread I gave the link for. Hope that helps.

Community
  • 1
  • 1
AlexRebula
  • 922
  • 2
  • 13
  • 26