Take the 2-minute tour ×

What I need help for is about the buttons... Two of the buttons are working (#levo and #desno)but not complitely, and the other two are not working at all.

How do I want them to work? I have two troubles:

1) When i press the button #levo it moves the selected dataItem form the first grid to the other, but if I select more than one dataItem from the first grid it moves only the first one (same thing for the other button #desno)

2) When I press the button #sitelevo I want all of the dataItem from the first grid to move to the other, with no selection (same thing for the #sitedesno)

Can anyone help me?

share|improve this question
Here is a jsfiddle of the view jsfiddle.net/WxCZf/4 –  NFeskova Jan 17 '13 at 12:35
Some clarifications. When you say "move" from one grid to the other, do you mean create the element in the second grid and delete it from the first grid (meaning, meaning a delete and create into the servers)? –  OnaBai Jan 17 '13 at 16:28
Yes.. Delete it from the first, and past it in the second and same for the opposite –  NFeskova Jan 21 '13 at 8:20
add comment

1 Answer

up vote 1 down vote accepted

I'm afraid that the problem is that jQuery.each() is meant to enumerate over immutable items. This means that you cannot remove items while executing the each since this would alter the list.

Example: Try comment the line where you remove the item from sourcegrid and leave the adding the item to the destinationgrid: you will see that the items are inserted in the destination.

sourcegrid.select().each(function () {
    dataItem = sourcegrid.dataItem($(this));
    // sourcegrid.dataSource.remove(dataItem);
    return null;
share|improve this answer
jsfiddle.net/WxCZf/5 –  NFeskova Jan 21 '13 at 8:13
Thank you for the help that is the correct way to solve it, but I did it before you tell me (you can check the jsfiddle). Thanks anyway :) –  NFeskova Jan 21 '13 at 8:13
There is only one problem now.. When I press the #sitedesno button, I want to delete the items of the second one and paste them in the first one. That works fine but, the thing is it doesn't delete them from the second one. –  NFeskova Jan 21 '13 at 8:25
here is the new version jsfiddle.net/WxCZf/6 –  NFeskova Jan 21 '13 at 8:26
Don't you think that your code is too complex? Why you do not use transport.update and transport.destroy instead of all those ajax. Do you really need them. It's hard for me to follow you logic. –  OnaBai Jan 21 '13 at 9:02
show 1 more comment

Your Answer


