添加下拉列表到弹出菜单的网格(剑道)



我有一个剑道网格,我需要添加一个下拉列表到我的网格,代码是:

$("#grid").kendoGrid({
      dataSource: dataSource,
      pageable: true,
      height: 550,
      toolbar: ["create"],
      columns: [
       { field:"ProductName", title: "Product Name" },
       { command: ["edit"], title: " ", width: "250px" }],
                        editable: "popup"
                    });
                });

尝试这样的事情:

columns: [
    {
        field: "ENCODE",
        title: "Encoding",
        width: "100px",
        editor: encodingEditor
    }
]
function encodingEditor(container, options) {
    $('<input data-bind="value:' + options.field + '"/>')
      .appendTo(container)
      .kendoDropDownList({
          valuePrimitive: true,
          autoBind: false,
          dataTextField: "NAME",
          dataValueField: "NAME",
          dataSource: encodingDataSource
      });
};
var encodingDataSource = new kendo.data.DataSource({
    data: {
        "items": [
          {
              "NAME": "DOS",
          },
          {
              "NAME": "UKG",
          },
          {
              "NAME": "WIN"
          }
        ]
    },
    schema: {
        data: "items",
        model: {
            fields: {
                NAME: { type: "string" }
            }
        }
    }
});

最新更新