2014-03-31 31 views
0

我發現一些關於角劍道網格控制的奇怪的事情: 1)列標題似乎遵​​循實際的駝峯字段名稱而不是標題 2)在尋呼機區域我看到2個空的分頁按鈕,後面跟着一個「1」按鈕,接着是另外兩個空的按鈕。 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; 
      } 
     }; 
    } 
]); 
+0

更新:通過向dataSOurce定義添加pageSize:5,解決了尋呼機問題。列標題仍然是一個問題 –

回答

1

columns定義需求,是您的網格配置的一部分,而不是爲dataSource配置的一部分。

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

以下是有趣的內容:將k-columns重定位到html文件確實解決了標題問題,但它也完全混淆了行高亮的方式 - 只有行文本背景現在突出顯示;當選擇不同的行時,前一行仍然存在一些殘留的高亮 - 奇怪 –