dear Kiril Nikolov ,
it showing error when tried this sample below
this is my template for treeview
<
script
id
=
"treeview-template"
type
=
"text/template"
>
<
span
class
=
"node"
>
#: item.caption #
</
span
>
<
input
type
=
'hidden'
class
=
'data_id'
value
=
'#: item.reportid #'
>
</
script
>
and this is my Treeview init
$.ajax({
url: url +
"reportname"
,
dataType:
"json"
,
async:
false
,
success:
function
(result) {
val = JSON.parse(result.d.toString());
},
error:
function
(result) {
falert(
"Alert"
,
"error"
);
}
});
var
TreeViewDataSource =
new
kendo.data.HierarchicalDataSource({
data: val,
schema: {
model: {
children:
"items"
}
}
});
and i'd placed the text box to search in treeview
and the code shown below
$(document).on(
"input"
,
"#txtsearchtree"
,
function
() {
var
val = $(
"#txtsearchtree"
).val();
var
treeview = $(
"#treeview"
).data(
"kendoTreeView"
),
item = treeview.findByText(val),
// find the node that will be shown
dataItem = treeview.dataItem(item),
nodeText = dataItem.caption;
// loop through the parents of the given node, filtering them to only one item
while
(dataItem.parentNode()) {
dataItem = dataItem.parentNode();
dataItem.children.filter({ field:
"caption"
, operator:
"contains"
, value: nodeText });
nodeText = dataItem.caption;
}
treeview.dataSource.filter({ field:
"caption"
, operator:
"contains"
, value: nodeText });
treeview.expand(
".k-item"
);
});
here it shows an error as
Uncaught TypeError: Cannot read property 'caption' of undefined
please suggest me where i'd done wrong in above example
and i'd worked by your example in Jsbin
it shows an error so please see below link and suggest me what can i done wrong
http://jsbin.com/ikejig/10/edit
thanks in advance
-santhosh