I have the following VM:
Which I am binding at the top a large DOM, which deep inside has the following two spans that are being data bound:
Every once and a while a message comes in from the server and I update the VM:
Ok, this works fine, as long as the line #8, iwhich does the rebind is in. But if I move the binding out of the update loop, and do it once at the beginning of the code, then this is not getting rebound! I thought the whole idea of MVVM was that you can just update the VM values. What am I missing.
I have looked in firebug, and I see that the VM is being updated, but I don't see the DOM changing unless I force it.
I am a noobie at MVVM so I assume I am doing something dumb.
var ExportVM = kendo.observable({ ticketID: "bad", maxTiles: 15, jobTime: "not yet set", timeEstimate: "really bad", tileRate: 0, tileCount: 0});<div id="ExportBeginBlock"> <div class="SectionBlock"> <span>Estimated Time:</span> <span data-bind="text: jobTime"></span> <span>Hours:Minutes:Seconds</span> </div> <div class="SectionBlock"> <span>Estimated Tile Files:</span> <span data-bind="text: maxTiles"></span> </div> <div id="buildMapPackageButton" class="k-button button green bigrounded">BUILD MAP PACKAGE</div> <div id="cancelMapButton" class="button rosy bigrounded k-button">CANCEL</div></div>01.function ShowEstimates(data)02.{03. ExportVM.set("maxTiles", data.maxTiles);04. ExportVM.set("ticketID", data.ticket);05. ExportVM.set("jobTime", data.timeEstimate);06. ExportVM.set("timeEstimate", data.timeEstimate);07. ExportVM.set("tileRate", data.tileRate);08. kendo.bind($("#ExportBlock"), ExportVM);09.}Ok, this works fine, as long as the line #8, iwhich does the rebind is in. But if I move the binding out of the update loop, and do it once at the beginning of the code, then this is not getting rebound! I thought the whole idea of MVVM was that you can just update the VM values. What am I missing.
I have looked in firebug, and I see that the VM is being updated, but I don't see the DOM changing unless I force it.
I am a noobie at MVVM so I assume I am doing something dumb.