【问题标题】:Kendo UI grid popup edit custom template - Add a multi-select controlKendo UI 网格弹出编辑自定义模板 - 添加多选控件
【发布时间】:2013-09-15 21:34:59
【问题描述】:

我正在为网格的编辑弹出选项使用自定义弹出编辑器模板:

editable: { mode: "popup",
    template: $("#popup_editor").html()
      },

<!-- popup editor template -->
    <script id="popup_editor" type="text/x-kendo-template">
            template
            </script>

要求模板有一些不在网格中的多选控件,用户在这些多选控件中选择的摘要决定了网格中的“摘要”字段。例如:

(multi-select1) color: red, blue, Purple --- 不是网格中的字段 (multi-select2) size: xs, s --- 不是网格中的字段

总结:color="red, blue, Purple" ; size="xs, s" --- 网格中显示的字段

问题是:如何在编辑弹出自定义模板中添加多选?

【问题讨论】:

    标签: javascript jquery kendo-ui


    【解决方案1】:

    您可以使用columns definition为字段指定自定义编辑器功能,即使在弹出编辑模式下也可以使用。

    columns: [ {
        field: "name",
        editor: function(container, options) {
         // create an input element
         var select= $("<select/>");
         // set its name to the field to which the column is bound ('name' in this case)
         select.attr("name", options.field);
         select.appendTo(container);
         select.kendoMultiSelect({ 
         dataSource: {
            data: ["red", "blue"]
           }    
         });
        }
      } ],
    

    【讨论】:

    • Jayantha 我很欣赏评论,但多选字段实际上不是网格字段的一部分。
    • 然后你可以在grid中的edit函数中执行此操作,每当你点击编辑时都会调用它,你可以使用e.container访问弹出窗口中的html?
    • 答案在线演示:Grid / Editing custom editor
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多