ajax - 剑道网格 : combobox field from json data

标签 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="category" data-bind="value:'+options.field+'"/>')
    .appendTo(container)
    .kendoDropDownList({
      autoBind: false,
      dataSource: {
        type: "json",
        transport: {
          read: "/api/notes/dumpcats"
        }
      }
    })
}

也在 model.fields 中:

  category: {
    type: "combobox",
    editable: true,
    validation: { required: true }
  },

没有错误,只是空的组合框和输入框,在输入类别时会出错。

未捕获类型错误:对象 [object Object] 的属性“_parse”不是函数

我使用了示例here

最佳答案

问题已解决,正如 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
            },
          }
        }
      })
  }

关于ajax - 剑道网格 : combobox field from json data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14057875/

相关文章:

javascript - 将表单数据转换为 AJAX 请求的请求数据

javascript - 如何防止那些 PHP 变量被缓存在 WordPress 上?

c# - ComboBox 的默认模板 : How does IsEditable switch TextBox and Contentpresenter

kendo-ui - 当树很大时,在kendo treeView中展开/折叠文件夹很慢

jquery - 使用大 JSON 字符串填充 Kendo UI 组合框

java - 如何从 servlet 获取 ajax 调用的响应

jquery - 在 Laravel 中使用 AJAX 提交数据时在 URL 中传递变量

vb.net - 为什么在 VB.NET 中没有出现 Binding Combobox usingdictionary with the MS ACCESS database with dapper

c# - 在不改变外观的情况下禁用 ComboBox

kendo-ui - Kendo UI DropDownList 作为带有复选框的多选