【问题标题】:Kendo Grid - Custom Editor function not being calledKendo Grid - 未调用自定义编辑器功能
【发布时间】:2014-08-05 14:51:06
【问题描述】:

我有以下 html 和两个函数,用于将自定义编辑器添加到带有复选框的网格中。首次使用 checkBoxTemplate 函数调出网格时,复选框会正确显示,但是当我尝试更新时,不会调用 checkBoxEditor 函数,因此我没有得到复选框,而是字符串“checkBoxEditor”。我做错了什么?

        <div id="dependencyGrid" data-role="grid"
            data-scrollable="true"
            data-editable="inline"
            data-sortable="true"
            data-toolbar="['create']"
            data-bind="source: dependencies"
            data-columns="[                  
                { field: 'ActiveFlag', title: 'Active', width: 30, editor: 'checkBoxEditor', template: '#=checkBoxTemplate(data.ActiveFlag)#' }
            ]">
        </div>

    checkBoxEditor = function (container, options) {
        if (options.model.ActiveFlag == 1)
            $('<input type="checkbox" checked=checked  class="chkbx activeflag" ></input> ').appendTo(container);

        else
            $('<input type="checkbox"  class="chkbx activeflag" ></input> ').appendTo(container);

    };

    checkBoxTemplate = function (input) {
        if (input == 1 || input == true) {
            return '<input type=checkbox checked=checked class=chkbx   disabled=disabled ></input>';
        }
            return '<input type=checkbox class=chkbx   disabled=disabled ></input>';
    }

【问题讨论】:

    标签: kendo-ui kendo-grid kendo-mvvm


    【解决方案1】:

    这是执行此操作的正确基本方法。我只是没有定义我的 checkBoxEditor 函数可以通过 html 访问它......所以,如果你想为一个复选框设置一个自定义编辑器,这应该对你有用。

    【讨论】:

      猜你喜欢
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      • 2017-06-14
      • 2014-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-04
      相关资源
      最近更新 更多