Attached are the two simple files that demonstrate the problem. I'm trying to load a simple JSON file and then update the data through the model. The trouble is, while the field value is changing in the model, the screen never gets updated unless I change the root of the tree. Any assistance is appreciated.
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title>MVVM Demo 2</title> <link href="/styles/kendo.common.min.css" rel="stylesheet"> <link href="/styles/kendo.rtl.min.css" rel="stylesheet"> <link href="/styles/kendo.default.min.css" rel="stylesheet"> <link href="/styles/kendo.default.mobile.min.css" rel="stylesheet"> <script src="/js/jquery.min.js"></script> <script src="/js/jszip.min.js"></script> <script src="/js/kendo.all.min.js"></script><style type="text/css">th {width: 135px; }</style></head><body><script>var elementMapping = new Map();</script> <div id="example" data-role="treeview" data-bind="source: root" data-text-field="_name"> </div><button type="button" data-bind="click: updateSomething" >Update</button> <script>var inputJSON="";const flatten = arr => arr.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);$.ajax({ url: "this.json", dataType: "json", cache: false, success: function(data) { inputJSON = data; var topSchema = { model: { id:"_secnum", children: "section", hasChildren: (e)=> e.section } }; var oh = kendo.observableHierarchy( { data: [inputJSON], schema: topSchema }); var viewModel = kendo.observable({ root: oh, updateSomething: function(){ var r = this.get("root"); var g = elementMapping[4]; g.set("_name", "test this thing"); } }); var rec = function(r){ elementMapping[r.id]=r; r.items.forEach(h=>rec(h)); } viewModel.root._dataSource.data().forEach(e=>rec(e)); kendo.bind($("body"), viewModel); }}); </script></body></html>
{ "_template": "Electronic Procedures Template", "_revision": "1.4.0", "section": [ { "_name": "Cover Page", "_secnum": "", "rititle1": [ ], "rinumber1": [ ], "rititle2": [ ], "rinumber2": [ ] }, { "_name": "Purpose", "_secnum": "1", "_sectype": "text" }, { "_name": "Scope", "_secnum": "2", "_sectype": "text", "section": [ { "_name": "Responsibilities", "_secnum": "1", "_sectype": "text" }, { "_name": "Background", "_secnum": "2", "_sectype": "text" } ] }, { "_name": "Precautions & Limitations", "_secnum": "3", "_sectype": "text" }, { "_name": "Prerequisite Actions", "_secnum": "4", "section": [ { "_name": "Radiological Concerns", "_secnum": "1", "_sectype": "text" }, { "_name": "Employee Safety", "_secnum": "2", "_sectype": "text" }, { "_name": "Special Tools and Equipment, Parts, and Supplies", "_secnum": "3", "_sectype": "text" }, { "_name": "Approvals & Notifications", "_secnum": "4", "_sectype": "single", "procedure": { "_seq": "9", "_sid": "0", "_refid": "", "_pagetype": "Master", "_procedurelevel": "1" } }, { "_name": "Preliminary Actions", "_secnum": "5", "_sectype": "single", "procedure": { "_seq": "10", "_sid": "0", "_refid": "", "_pagetype": "Master", "_procedurelevel": "1" } }, { "_name": "Field Preparations", "_secnum": "6", "_sectype": "single", "procedure": { "_seq": "11", "_sid": "0", "_refid": "", "_pagetype": "Master", "_procedurelevel": "1" } } ] }, { "_name": "Performance", "_secnum": "5", "_sectype": "multiple" }, { "_name": "References", "_secnum": "6", "section": [ { "_name": "Performance References", "_secnum": "1", "_sectype": "text" }, { "_name": "Source Requirements", "_secnum": "2", "_sectype": "text" } ] }, { "_name": "Records", "_secnum": "7", "_sectype": "text" }, { "_name": "Attachments", "_secnum": "8", "_sectype": "text" }, { "_name": "Monitor Response 1", "_secnum": "11", "_sectype": "monitortable" } ], "hashcode": "e388152e636cf0a2779c2da2dca7a534"}