Categories | Question details Back To List | ||
Stop duplicates in target grid when draging multipule items from another grid Thanks for your quick reply :) I am using this code to check the items dragged into grid 2 from grid 1. mygrid3.attachEvent("onDrag",function(sid,tid){ How do I make it work for "multiple items" dragged into the target grid? ---------------------------------------------------------------------------------------------------------------------------------------- I have two identical grid structures. ---------------------------------------------------------------------------------------------------------------------------------------- You can attach custom code to the onDrag event, which will get list of draged items ( incoming parameter ) , check which of them not exist in target grid (grid.getRowById returns null for not existing rows), after that execute moveRow ( or moveRowTo ) command against all rows , which need to be moved and return false to block original d-n-d action.
Answer posted by Support on Oct 31, 2008 03:10 Unfortunately it can't be done in such simple manner for group of rows, because only sinlge event will fire for all dragged rows, and you can block or confirm all rows at once. The solution with custom moveTo calls , proposed originally still can be used in your way. Alternativly you can try to use next code mygrid3.attachEvent("onDrag",function(sid,tid){ var ids=sid.split(","); for (var i=ids.length-1; i>=0; i--){ if(mygrid3.getRowById(ids[i])) mygrid3.dragContext.sid.splice(i,1); // delete draged row from list of draged return true; }); |