我有数据源数组,我想通过数据绑定属性绑定
<div data-role="listview"
data-template="template3"
data-bind="source: products"></div>
模板3:
<script type="text/x-kendo-template" id="template3">
# for (var y = 0; y < data.length; y++) { #
<div data-role="listview"
data-template="template"
data-bind="source: data[y]"></div>
# } #
</script>
视图模型:
var viewModel = kendo.observable({
products: [new kendo.data.DataSource({
schema: {
model: {
id: "Id"
}
},
transport: {
read: {
url: "@Url.Action("Products", "Home")",
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
}
})]
我得到错误:
未捕获的 ReferenceError:未定义 y