我有两个 Kendo UI ListViews。我能够获取加载和显示值的可用选项列表。我还能够使拖动功能正常工作。问题是目的地的丢弃功能。我可以让第二个 ListView 注册为 dropTarget,但我无法确定如何将可拖动对象添加到目标 ListView。
以下是相关代码:
var groupDataSource = getReadGroupsDataSourceFor(2819);
try {
var readgroups = $("#availableReadGroups").kendoListView({
selectable: "single",
navigatable: false,
template: "#if(!IsSelectedGroup) {# <div style='font-size:13px;padding-left:5px;padding-top:5px;'>${GroupName}</div>#} else {# <div class=\"k-state-selected\" style=\"font-size:13px;padding-left:5px;padding-top:5px;\" aria-selected=\"true\">${GroupName}</div> #}#",
dataSource: groupDataSource
});
var selectedGroups = $("#selectedGroupsValues").kendoListView({
selectable: "single",
navigatable: false,
template: "#if(!IsSelectedGroup) {# <div style='font-size:13px;padding-left:5px;padding-top:5px;'>${GroupName}</div>#} else {# <div class=\"k-state-selected\" style=\"font-size:13px;padding-left:5px;padding-top:5px;\" aria-selected=\"true\">${GroupName}</div> #}#",
});
readgroups.kendoDraggable({
filter: "div[role=option]",
hint: function (row) {
return row.clone();
}
});
selectedGroups.kendoDropTarget({
drop: function (e) {
var lvObject= selectedGroups.data();
lvObject.kendoListView.dataSource.add(e.draggable);
}
});
} catch (err) {
alert(err);
}