This question is locked. New answers and comments are not allowed.
| Hi i am trying to get the value of the clicked treeview node as a parameter and then append the child nodes underneath it by making a client side call. but i get only the item.text() property but not the item.value() property. Any suggestions???? <script type="text/javascript"> |
| function onSelect(e) { |
| debugger; |
| var tv = $("#TreeView").data("tTreeView"); |
| var item = $(e.item); |
| //$console.log('OnSelect :: ' + item.text()); |
| //its not giving me the item.value() here..... |
| $.post('/Resource/GetJSONTree2', { SubjectID: $("#Subject").val(), SelectedStdID: item.value() }, function(data) { |
| onPass(data, status); |
| }); |
| } |
| function onPass(data, status) |
| { |
| //what will be code here to append json as a child to the selected node? |
| } |
| function onDataBinding(e) { |
| var treeview = $('#TreeView').data('tTreeView'); |
| var jsonObject = [ |
| { Value: "1", Text: "Product 1", Expanded: true, |
| Items: [ |
| { Value: "4", Text: "Product 4", Expanded: true, |
| Items: [ |
| { Value: "6", Text: "Product 6" }, |
| { Value: "7", Text: "Product 7" } |
| ] |
| }, |
| { Value: "5", Text: "Product 5" } |
| ] |
| }, |
| { Value: "2", Text: "Product 2 (unavailable)", Enabled: false }, |
| { Value: "3", Text: "Product 3" } |
| ]; |
| treeview.bindTo(jsonObject); |
| } |
| </script> |
| <p> |
| <% Html.Telerik().TreeView() |
| .Name("TreeView") |
| .ClientEvents(events => events |
| .OnDataBinding("onDataBinding") |
| .OnSelect("onSelect") |
| ) |
| .Render(); |
| %> |
| </p> |