Bind Kendo UI treeview to Json data returned by ASP.Net .ashx handler -
i want create treeview kendo ui treeview widjet.
i read documentation, can't go further first step: bind simple, simple non-nested json value:
in head section put:
<script> $(document).ready(function () { var homogeneous = new kendo.data.hierarchicaldatasource({ transport: { read: { url: "kendotwdata.ashx", datatype: "json" } }, schema: { model: { id: "employeeid", fullname: "fullname" } } }); $("#treeview").kendotreeview({ datasource: homogeneous, datatextfield: "fullname", datavaluefield: "id" }); }); </script>
the handler "kendotwdata.ashx" correctly return: {"employeeid":1,"fullname":"aname"} nothing appears.
thanks in advance.
it should return array
, not object
. should be:
[{"employeeid":1,"fullname":"aname"}]
this because tree
might have multiple nodes
@ root
level.
Comments
Post a Comment