Hi,
I am trying to implement Multi select items drag and drop from 1 listview to another.
I know that both selectable and draggable listen to the same event Select, hence directly we cannot do. Can someone help with some work around?
Here is my working code for single selection drag and drop: I want to make it work for selecting multiple drag and drop.
var
dataSourceSalesRole =
new
kendo.data.DataSource({
data: salesRole,
pageSize: 21
});
var
dataSourceSalesRoleContainer =
new
kendo.data.DataSource({
data: salesRoleContainer,
pageSize: 21
});
$(
"#listViewSalesRole"
).kendoListView({
dataSource: dataSourceSalesRole,
template: kendo.template($(
"#templateSalesRole"
).html())
});
$(
"#listViewSalesRoleContainer"
).kendoListView({
dataSource: dataSourceSalesRoleContainer,
template: kendo.template($(
"#templateSalesRoleContainer"
).html())
});
$(
"#listViewSalesRole"
).kendoDraggable({
group:
"salesRole"
,
filter:
".move"
,
hint:
function
(element) {
return
element.clone();
}
});
$(
"#listViewSalesRoleContainer"
).kendoDropTarget({
group:
"salesRole"
,
dragenter:
function
(e) {
e.draggable.hint.css(
"opacity"
, 0.6);
},
dragleave:
function
(e) {
e.draggable.hint.css(
"opacity"
, 1);
},
drop:
function
(e) {
var
count = 0;
var
dropItem = dataSourceSalesRole.getByUid(e.draggable.hint.data().uid);
var
salesRoleId = dropItem.SalesRoleId;
var
saleRoleContainerData = dataSourceSalesRoleContainer.data();
$(saleRoleContainerData).each(
function
() {
if
(
this
.SalesRoleId == salesRoleId) {
alert(
'Sales Role already exist! Cannot add.'
);
count++;
}
});
if
(count == 0) {
dataSourceSalesRoleContainer.add(dropItem);
dataSourceSalesRole.remove(dropItem);
}
}
});