(I am NOT saying this is a bug, What I am saying is my brain needs training :-) )
I have a TABLE that is DataBound to an ObservableArray (called vm.ServerData).
The body of the table is bound to the values in the Array via the data-template as follows:
Everything works fine the first time the page is entered. The issue is that the user can issue commands that update the ServerData[i[.Newer field.
They update is done in code as follows:
What I observe, is that the TD (line #14) updates just fine. But the IF/THEN/ELSE condition (lines 7-11) is not getting executed. [What is odd is that lines #7-11 are executing properly the first time the page is updated. So it is clearly that the change from the text of "NEW" -> "CURRENT" in via SET() that is not firing a change in the template code.
OK,
I can do a crude force of the issue by adding line #4 below:
And this will force the IF/THEN/ELSE to execute and my page works. But I think I am doing something very brutal to the KENDO MVVM paradigm (actually,
I am violating the whole MVVM concept). So pray tell, What is the elegant way to do this?
I have a TABLE that is DataBound to an ObservableArray (called vm.ServerData).
<div id="ServerTable" class="row Block InfoTable "> <table> <thead> <tr> <th>ACTION</th> <th>Type</th> <th>Class</th> <th>Status</th> <th>Size</th> </tr> </thead> <tbody data-bind="source: ServerData" data-template="serverTemplate"></tbody> </table></div>01.<script type="text/x-kendo-template" id="serverTemplate">02. <tr data-path="${Path}"03. data-filecount="${FileCount}"04. data-maxzoom="${MaxZoom}"05. data-date="${Date}"06. data-type="${Type}">07. #if(Newer == "NEW") { #08. <td><div class="button radial Center ButtonText">Download</div></td>09. #} else { #10. <td title="Already Downloaded"><img src="../images/pushPin.png" style="width: 32px; height: 32px;" /></td>11. #}#12. <td><span data-bind="text: Type" /></td>13. <td><span data-bind="text: Class" /></td>14. <td><span data-bind="text: Newer" /></td>15. <td><span data-bind="text: Size" /></td>16. </tr>17.</script>Everything works fine the first time the page is entered. The issue is that the user can issue commands that update the ServerData[i[.Newer field.
They update is done in code as follows:
if ((dd.Type == sd.Type) && (dd.Date >= sd.Date)) { vm.ServerData[i].set("Newer", "CURRENT");}What I observe, is that the TD (line #14) updates just fine. But the IF/THEN/ELSE condition (lines 7-11) is not getting executed. [What is odd is that lines #7-11 are executing properly the first time the page is updated. So it is clearly that the change from the text of "NEW" -> "CURRENT" in via SET() that is not firing a change in the template code.
OK,
I can do a crude force of the issue by adding line #4 below:
1. if ((dd.Type == sd.Type) && (dd.Date >= sd.Date)) {2. vm.ServerData[i].set("Newer", "CURRENT");3. }4.kendo.bind($("#ServerTable"), vm.ServerData);I am violating the whole MVVM concept). So pray tell, What is the elegant way to do this?