I can just give you hint. I have done swapping between grids in my project. I am using kendo-grid.
First on a selection of checkbox I took one array in which I push my selected row data. After that on swap button click( swapping from right to left ), I push data in left grid data and splice data from right grid data by checking both data positions.
This might help you with your problem. Code for swapping is much longer in my project because there are many validations too. So I providing you with some of my code.
OnSelectionChange(){
if (event.selectedRows.length > 0 && event.selectedRows[0].dataItem != undefined) {
for (let i = 0; i < event.selectedRows.length; i++) {
this.rightGridSelectedData.push(event.selectedRows[i].dataItem);
}
}
else if (event.deselectedRows.length > 0) {
for (var index = 0; index < this.rightGridSelectedData.length; index++) {
if (this.rightGridSelectedData[index].featureID === event.deselectedRows[0].dataItem.featureID && this.rightGridSelectedData[index].moduleID === event.deselectedRows[0].dataItem.moduleID) {
this.rightGridSelectedData.splice(index, 1);
}
}
}
}