Kendo UI Grid,在模板Angularjs中添加行号

时间:2017-03-09 09:34:49

标签: angularjs kendo-ui kendo-grid

我想将kendo ui grid与自定义复选框模板绑定行索引绑定为复选框ID,如下所示:

 var record = 1;

 $scope.mainGridOptions = {
            dataSource: {
                data: $scope.LockingList,
                pageSize: 15
            },
            schema: {
                // the data, which the data source will be bound to is in the "list" field of the response
                data: "EmployeeList",
                type: "json"
            },
            sortable: true,
            filterable: {
                extra: false,
                operators: {
                    string: {
                        eq: "Is equal to",
                        neq: "Is not equal to"
                    }
                }
            },
            pageable: true,
            dataBound: function () {
                this.expandRow(this.tbody.find("tr.k-master-row").first());
                record = (this.dataSource.page() - 1) * this.dataSource.pageSize();
            },
            columns: [{
                field: "EmployeeName",
                title: "Employee Name",

            },
            {
                template: "<input type='checkbox' id='#= ++record #' class='checkbox' ng-checked='dataItem.Locked' ng-click='LockByTask(dataItem)'  />   <label for='#= ++record #'></label>",
                title: "<input type='checkbox' id='header' title='Select all' ng-click='toggleSelectAll($event)' /><label for='header'></label>",
                width: 60
            }
            ],
            editable: "popup"
        };

我没有定义记录,也无法绑定行号。如何做到这一点?感谢。

0 个答案:

没有答案