如何将Kendo编辑器设置为单元格模板?

时间:2015-08-11 10:05:33

标签: javascript angularjs kendo-ui kendo-template kendo-editor

要求1: 我需要用户能够始终编辑网格内容,这意味着template,不应要求用户单击该字段,然后显示编辑器。

要求2:我想要一个kendo编辑器供用户输入/编辑值。

以下是我尝试的内容,因为我不知道如何使用我使用editor尝试的模板

网格设置:

                    dataSource: {
                    data: $scope.planOverviewModel,
                    sort: {
                        field: "TermName",
                        dir: "asc"
                    },
                    schema: {
                        model: {
                            fields: {
                                TermName: { type: "string", editable: false },
                                InNetwork: { type: "string", editable: true },
                                OutNetwork: { type: "string", editable: true }
                            }
                        }
                    },
                },
                columns: [
                    { field: "TermName", title: "Term" },
                    {
                        field: "InNetwork",
                        title: "In-Network",
                        editor: $scope.setupTextBox
                    },
                    {
                        field: "OutNetwork",
                        title: "Out-Network",
                        editor: $scope.setupTextBox
                    }
                ],
                editable: true,
                change: function (e) {
                    console.log("changed");
                    if (e.action == "itemchange") {
                        this.sync();
                    }
                }

编辑设置:

$scope.setupTextBox = function(container, options) {
    $('<textarea class="form-control" type="text" data-bind="value:' + options.field + '"> </textarea>')
        .appendTo(container).kendoEditor({
            resizable: {
                content: true,
                toolbar: true
            }
        });
};

0 个答案:

没有答案
相关问题