【发布时间】:2016-06-29 15:21:35
【问题描述】:
这是我从here得到的下拉代码:
myDropDownEditor(container, options) {
//var fieldName="";
$('<input required data-text-field=\"myType\" data-value-field="id" data-bind="value:name"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataSource: {
data: this.myList
}
});
}
在运行时,当我单击网格上的编辑按钮时,出现以下错误:
my-type.ts:138 Uncaught TypeError: Cannot read property 'myList' of undefined
有什么想法吗?
【问题讨论】:
-
你确定你在 this.myList 中有数据并且它不是像错误提示的那样未定义吗?
-
@calinaadi 是的,我确定。
-
我会说那个上下文中的“this”是指尚未创建且未定义的数据源。
-
尝试将
myDropDownEditor(container, options) { ... }更改为myDropDownEditor = (container, options) => { ... }
标签: kendo-ui kendo-grid aurelia