Hi,
I run into a problem with the sample code below and I am not sure what causes it. The problem is that the "temperatureLabel" gets display only once inside the for loop in the "myTemplate" template.
var viewModel = kendo.observable({temperatureLabel: "Temperature", mydata:[]});
$.ajax({
url: url,
context: this,
type: "GET",
success: function(data) {
this.viewModel.set("mydata", data);
kendo.bind($("#view"), viewModel, kendo.mobile.ui);
},
error: function(xhr, statusText, errorThrown) {
console.log(errorThrown);
},
timeout: 10000
});
<div id="view">
<ul id="taf-panelbar" data-bind="source: mydata" data-template="myTemplate"></ul>
</div>
<script id="myTemplate" type="text/x-kendo-template">
# for (var i = 0; i < forecast.length; i++) { #
<li>
<div>
<table style="border: 1px solid lightGray; border-radius:6px;">
<tr>
<td class="label"><span data-bind="text:temperatureLabel></span></td>
<td>:</td>
<td style="text-align:left;"><span>#=forecast[i].temperature#</span></td>
</tr>
</table>
</div>
</li>
# }#
</script>
Can someone shed some lights on this?
Thanks,
Kee
I run into a problem with the sample code below and I am not sure what causes it. The problem is that the "temperatureLabel" gets display only once inside the for loop in the "myTemplate" template.
var viewModel = kendo.observable({temperatureLabel: "Temperature", mydata:[]});
$.ajax({
url: url,
context: this,
type: "GET",
success: function(data) {
this.viewModel.set("mydata", data);
kendo.bind($("#view"), viewModel, kendo.mobile.ui);
},
error: function(xhr, statusText, errorThrown) {
console.log(errorThrown);
},
timeout: 10000
});
<div id="view">
<ul id="taf-panelbar" data-bind="source: mydata" data-template="myTemplate"></ul>
</div>
<script id="myTemplate" type="text/x-kendo-template">
# for (var i = 0; i < forecast.length; i++) { #
<li>
<div>
<table style="border: 1px solid lightGray; border-radius:6px;">
<tr>
<td class="label"><span data-bind="text:temperatureLabel></span></td>
<td>:</td>
<td style="text-align:left;"><span>#=forecast[i].temperature#</span></td>
</tr>
</table>
</div>
</li>
# }#
</script>
Can someone shed some lights on this?
Thanks,
Kee