If is possible and it is not hard to do but you have to do it by yourself so you need:
- Some knowledge on KendoUI
Grid
and DataSource
and the events that they expose.
- Some knowledge on JavaScript + jQuery that help you with the validations and avoiding errors.
Lets have the following grid definitions:
var grid1 = $("#grid1").kendoGrid({
dataSource: ds1,
selectable: "multiple",
navigatable: true,
pageable: false,
columns: [
{ field: "name", title: "Name" },
{ field: "lastName", title: "Last Name" }
]
}).data("kendoGrid");
var grid2 = $("#grid2").kendoGrid({
dataSource: ds2,
selectable: "multiple",
navigatable: true,
pageable: false,
columns: [
{ field: "name", title: "Name" },
{ field: "lastName", title: "Last Name" }
]
}).data("kendoGrid");
We define two buttons:
- for copying selected rows from
grid1
to grid2
- for copying selected rows from
grid2
to grid1
The button definition is:
<div><a href="#" id="copySelectedToGrid2" class="k-button">></a></div>
<div><a href="#" id="copySelectedToGrid1" class="k-button"><</a></div>
And the JavaScript for managing it:
$("#copySelectedToGrid2").on("click", function (idx, elem) {
moveTo(grid1, grid2);
});
$("#copySelectedToGrid1").on("click", function (idx, elem) {
moveTo(grid2, grid1);
});
Finally the moveTo
would be something like:
function moveTo(from, to) {
var selected = from.select();
if (selected.length > 0) {
var items = [];
$.each(selected, function (idx, elem) {
items.push(from.dataItem(elem));
});
var fromDS = from.dataSource;
var toDS = to.dataSource;
$.each(items, function (idx, elem) {
toDS.add({ name: elem.name, lastName: elem.lastName });
fromDS.remove(elem);
});
toDS.sync();
fromDS.sync();
}
}
Example of this here