Ajax kendoGrid:json数据的组合框字段
这里是字段:Ajax kendoGrid:json数据的组合框字段,ajax,combobox,kendo-ui,Ajax,Combobox,Kendo Ui,这里是字段: { field: "category", title: "Category", width: 100, editor: categoryDropDownEditor }, 自定义编辑器: function categoryDropDownEditor(container, options) { console.log('used editor') $('<input data-text-field="category" data-value-field="categ
{ field: "category", title: "Category", width: 100, editor: categoryDropDownEditor },
自定义编辑器:
function categoryDropDownEditor(container, options) {
console.log('used editor')
$('<input data-text-field="category" data-value-field="category" data-bind="value:'+options.field+'"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataSource: {
type: "json",
transport: {
read: "/api/notes/dumpcats"
}
}
})
}
没有错误,只是空的组合框和输入框,当输入类别时会出现错误
未捕获的TypeError:对象[object object]的属性“\u parse”不是函数
我举了一个例子,正如Burke Holland在下面的帖子中指出的那样,问题已经解决了:
function categoryDropDownEditor(contrainer, options) {
$('<input data-text-field="category" data-value-field="category" data-bind="value:' + options.field + '"/>"')
.appendTo(contrainer)
.kendoComboBox({
index: 0,
placeholder: "Select category",
dataTextField: "category",
dataValueField: "category",
dataSource: {
transport: {
read: {
url: '/api/notes/cats',
dataType: 'json',
type: 'GET',
},
},
schema: {
data: function(reply) {
return reply.rows
},
}
}
})
}
函数类别HydropDownEditor(控件、选项){
$('"')
.appendTo(container)
kendoComboBox先生({
索引:0,
占位符:“选择类别”,
dataTextField:“类别”,
dataValueField:“类别”,
数据源:{
运输:{
阅读:{
url:“/api/notes/cats”,
数据类型:“json”,
键入:“GET”,
},
},
模式:{
数据:功能(回复){
返回reply.rows
},
}
}
})
}
你能在JSFiddle或JSBin中为我们复制这个问题吗?这会让我们更容易进行故障排除。谢谢!抱歉,我不知道如何使用这些:/没问题!只要转到JSFiddle.net或JSBin.com,你就可以复制你的问题。然后我们可以转换代码并修复它。
function categoryDropDownEditor(contrainer, options) {
$('<input data-text-field="category" data-value-field="category" data-bind="value:' + options.field + '"/>"')
.appendTo(contrainer)
.kendoComboBox({
index: 0,
placeholder: "Select category",
dataTextField: "category",
dataValueField: "category",
dataSource: {
transport: {
read: {
url: '/api/notes/cats',
dataType: 'json',
type: 'GET',
},
},
schema: {
data: function(reply) {
return reply.rows
},
}
}
})
}