簡體   English   中英

如何從Kendo UI排序中獲取項目列表

[英]How to get item list from kendo ui sortable

我想使用kendo ui sortable listview從綁定對象中獲取排序的列表項。 請從下面參考示例代碼。

http://dojo.telerik.com/@lilan123/eWofa/2

一種方法是使用在移動或更改可排序列表時觸發的Kendo事件,以在移動的ng-repeat中設置項目的新索引值。

您可以在“更改時更改”中設置事件。

<ol id="sortable" kendo-sortable k-options="sortableOptions" k-on-change="change(kendoEvent)">

然后將事件添加到范圍。

$scope.change = function(e) {
  console.log(e);
  alert("The e object has stuff like the old index:" + e.oldIndex);
  //Get the correct item from the bound list based on index and change the index values in the list to match.       
}

看起來像是駭客,但話又說回來,當使用Telerik控件時,總感覺像是駭客。

這是一篇很好的博客文章,介紹了如何將事件與角度事件一起使用以及它們所謂的最佳實踐。 希望能幫助到你!

暫無
暫無

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

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