角 - 剑道网格 - 一些奇怪的观察

时间:2014-03-31 23:28:37

标签: angular-kendo

我发现了一些关于angular-kendo网格控件的奇怪的事情: 1)列标题似乎遵​​循实际的驼峰字段名称而不是标题 2)在寻呼机区域,我看到2个空的分页按钮,然后是一个“1”按钮,接着是另外2个空按钮 3)当网格首次出现时 - 在按钮右侧,我看到“NaN - NaN of 5 items”

有人知道怎么解决这个问题吗?

这是我的HTML:

<div ng-controller="ApplicationGeneralWizardCtrl">
        <h3 class="text-muted">Step 2: Select Application To Describe</h3>

    <div kendo-grid=""
            k-data-source="dataSource"
            k-sortable="true"
            k-groupable="true"
            k-filterable="true"
            k-on-change="selectedItem = data"
            k-selectable="'row'"
            k-pageable='{ "refresh": true, "pageSizes": true }'
            >

    </div>
    <div>
        <p>{{selectedItem}}</p>
    </div>
</div>

这是我的控制器:

'use strict';

angular.module('wizardApp').controller('ApplicationGeneralWizardCtrl', ['$scope',
    function ($scope) {
            console.log('Entering ApplicationGeneralWizardCtrl');

        $scope.dataSource = {
            data: [
                { id: 1, name: 'Tennis Balls', department: 'Sports', lastShipment: '10/01/2013' },
                { id: 2, name: 'Basket Balls', department: 'Sports', lastShipment: '10/02/2013' },
                { id: 3, name: 'Oil', department: 'Auto', lastShipment: '10/01/2013' },
                { id: 4, name: 'Filters', department: 'Auto', lastShipment: '10/01/2013' },
                { id: 5, name: 'Dresser', department: 'Home Furnishings', lastShipment: '10/01/2013' }
            ],
            columns:
                [
                    { "field": "id", "title": "ID"},
                    { "field": "name", "title": "Name"},
                    { "field": "department", "title": "Department"},
                    { "field": "lastShipment", "title": "Last Shipment" }
                ]
        };
        $scope.rowSelected = function(e) {
            var grid = e.sender;
            var selectedRows = grid.select();
            for (var i = 0; i < selectedRows.length; i++) {
                $scope.selectedItem = grid.dataItem(selectedRows[i]);
                break;
            }
        };
    }
]);

1 个答案:

答案 0 :(得分:1)

您的columns定义需要成为网格配置的一部分,而不是dataSource的部分配置。

k-columns="[{'field': 'id', 'title': 'ID'}, ... ]"