簡體   English   中英

使用Angular Kendo進行劍道列表視圖時不顯示任何結果

[英]Display no results using Angular Kendo for kendo list view

我正在使用Angular Kendo並建立一個列表。

<kendo-mobile-list-view id="myList" class="item-list" k-template="templates.myListTemp" k-data-source="myService.myDataSource">
</kendo-mobile-list-view>

我正在使用Kendo DataSourceObservableArray為服務中的列表生成數據。

this.myDataSource = new kendo.data.DataSource({ data:this.myObservableArray });
this.myObservableArray.push({ key: "test", id:"test" });

每個人都按預期工作。

現在,我想在它們沒有記錄可顯示時顯示一條消息,在我顯示列表的地方,例如“沒有要顯示的記錄,請刷新”。

如何使用角度劍道實現此目的。
我看到Kendo JQuery的帖子很少,但是Angular Kendo卻沒有解決方案。

定義網格

 $('#grid').kendoGrid({ dataSource: employeeDataSource, dataBound: function () { DisplayNoResultsFound($('#grid')); }, 

javascript函數“ DisplayNoResultsFound”如下

 function DisplayNoResultsFound(grid) { // Get the number of Columns in the grid var dataSource = grid.data("kendoGrid").dataSource; var colCount = grid.find('.k-grid-header colgroup > col').length; // If there are no results place an indicator row if (dataSource._view.length == 0) { grid.find('.k-grid-content tbody') .append('<tr class="kendo-data-row"><td colspan="' + colCount + '" style="text-align:center"><b>No Results Found!</b></td></tr>'); } // Get visible row count var rowCount = grid.find('.k-grid-content tbody tr').length; // If the row count is less that the page size add in the number of missing rows if (rowCount < dataSource._take) { var addRows = dataSource._take - rowCount; for (var i = 0; i < addRows; i++) { grid.find('.k-grid-content tbody').append('<tr class="kendo-data-row"><td>&nbsp;</td></tr>'); } } } 

首先,您應該為myList實例添加一個名稱( myList ):

<kendo-mobile-list-view="myList" id="myList" class="item-list" k-template="templates.myListTemp" k-data-source="myService.myDataSource">
    </kendo-mobile-list-view>

然后,在您的控制器中:

$scope.myList.bind('dataBound',DisplayNoResultsFound)

您也可以在html中指定一些k-options ,並從角度控制器讀取這些選項(包括dataBound ), 此鏈接對此有更多說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM