Hi,
I have tried this every way I can think of. I am having problems with setting data-bind while iterating an array.
Made a small demo below, the actual code is much more complex and that is the reason I need to use the for loop in order to get the correct result.
How can I set the data-bind property on the input correctly?
<div id="container">
<div id="weekdays" data-template="weekday" data-bind="source : this"></div>
</div>
<script id="weekday" type="text-x-kendo-template">
<div>
# for (i = 0; i < data.lines.length; i++) { #
<h2>#: data.lines[i].day #</h2>
<input type="text" data-bind="value: data.lines[i].quantity" />
# } #
</div>
</script>
<script>
$(document).ready(function () {
var vm = kendo.observable({
lines: new kendo.data.ObservableArray([
{ id: 123, day: "Monday", quantity: 5 },
{ id: 322, day: "Tuesday", quantity: 2 }
])
});
kendo.bind($("#container"), vm);
});
</script>
For future reference, this did the trick;
<input type="text" data-bind="value: lines[#:i#].quantity" />