2

要求1: 我需要用户一直能够编辑网格的内容,这意味着作为一个template,用户不应该被要求点击字段然后编辑器出现。

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

以下是我尝试过的,因为我不知道如何使用我尝试使用的模板来做到这一点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
            }
        });
};
4

0 回答 0