Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Richard White on Nov 23, 2007 06:53
open dhtmlx forum
drag and drop order

Hi,

we have a treegrid and a normal grid on 1 page. we are dragging items from the tree grid to the normal grid. however when they are being dropped into the grid they are not in the same order as they were in the tree, they are in reverse order.

e.g:

in the tree we could have items:

item 1
item 2
item 3

then when we drag and drop them all into the grid they are being added as follows:

item 3
item 2
item 1

please can you tell us how to get the order exactly the same when they are being dropped into the grid

thanks
Answer posted on Nov 23, 2007 07:43
Such problem may occur for dhtmlxTreeGrid 1.3 or older - just update to latest version.
In case of dhtmlxgrid 1.4 the items droped in order of selection, so if you select items in order 3,2,1 - they will be inserted in target grid in same order.
Answer posted on Nov 23, 2007 07:44
Starting from dhtmlxGrid 1.4 you can use next command

grid.enableDragOrder(true);

which force to maintain same order after d-n-d
Answer posted by Richard White on Nov 23, 2007 07:58
Hi, ok thanks that works fine except if i drag a whole folder into a grid

e.g.

folder 1:
    item 1
    item 2
    item 3

if i drag the folder into the grid it drops as:

item 3
item 2
item 1

even when i have the grid.enableDragOrder(true); that you just gave me

thanks

Answer posted by Richard White on Dec 14, 2007 10:28
This questions was asked a long time ago and it is very important that we get an answer to this question

Thanks
Answer posted by Richard White on Dec 14, 2007 13:25
Can you also tell us the following: when a folder is dragged to another grid the source id only provides the folder id and not its kids, is there a way that we can get an array of all ids that were dragged even folder children

thanks

please answer the main question above also as we have been waiting for a very long time for you to answer. thanks
Answer posted by Richard White on Dec 15, 2007 05:26
Hi, we have just noticed that there is a huge bug in this drag and drop - we tried to drag 4 folders across with the multi select and when dragged across everything was not in the correct order - all the children from all folders went into one folder - then when we clicked on a folder all the other folders disappeared. please get back to us asap with the answer as to why this is and a fix for it.

please also answer the questions as to why when we drag a folder to another tree grid why all of its contents are reversed even when we specify the code enableDropOrder(true); we are using v 1.4 as well

please reply asap as we have a deadline and our customer is beginning to get very upset that there seams to be so many bugs with this drag and drop

thanks
Answer posted by Richard White on Dec 16, 2007 14:47
If it helps you in explaining the bug to us when the user drags over an item that has children:

like i said when an item is dragged that has children it reverses the order of the children - however i have just noticed that when i apply a grid.forEachRow function it actually loops through the rows in the correct order - so why are they appearing in the wrong order - very strange

thanks, i look forward to your reply
Answer posted by Support on Dec 17, 2007 06:25
>>This questions was asked a long time ago and it is very important that we get an answer to this question

Issue fixed, fix will be released as part of oncoming update,
If you need it ASAP - please contact directly at support@dhtmlx.com and provide your ref. number.
Answer posted by Support on Dec 17, 2007 06:26
>>Can you also tell us the following: when a folder is dragged to another grid the source id only provides the folder id and not its kids, is there a way that we can get an array of all ids that were dragged even folder children


You can use
    grid.getSubItems(..
 or
    grid.getAllSubItems
to get list of child rows
Answer posted by Support on Dec 17, 2007 06:29
>>we tried to drag 4 folders across with the multi select and when dragged across everything was not in the correct order

If problem still occurs for you - please provide any kind of sample where it can be reconstructed.