<ul class="ones" data-bind="foreach: itemsOne, kendoSortable: { data: itemsOne, connectWith: '.twos' }">
<li class="item" data-bind="text: name"></li>
</ul>
<hr/><div data-bind="foreach: itemsOne"><span data-bind="text: name"></span>,</div><hr/>
<ul class="twos" data-bind="foreach: itemsTwo, kendoSortable: { data: itemsTwo, connectWith: '.ones' }">
<li class="item" data-bind="text: name"></li>
</ul>
<hr/><div data-bind="foreach: itemsTwo"><span data-bind="text: name"></span>,</div>
var ViewModel = function() {
this.itemsOne = ko.observableArray([
{ name: "one" },
{ name: "two" },
{ name: "three" }
]);
this.itemsTwo = ko.observableArray([
{ name: "four" },
{ name: "five" },
{ name: "six" }
]);
};
ko.applyBindings(new ViewModel());
小提琴是:
http://jsfiddle.net/pdudeja/X7y2k/
我已经包含了所有js文件。只是名为&#39; ones&#39;和&#39; twos&#39;不在这里。此示例直接来自文档URL:
答案 0 :(得分:1)
问题是在Knockout和Kendo脚本加载后需要包含Knockout-Kendo。
http://rniemeyer.github.io/knockout-kendo/js/knockout-kendo.min.js
这个需要移动到最后。这是一个更新的小提琴:http://jsfiddle.net/rniemeyer/zzYjX/