All,
I have an ADG that contains a grouped collection. In the dataset,
there are 21 nodes...each node has 1 to many children. When I attempt
to drag a row, either from another node or within the last node, and
drop it below the last item in the last node(i.e. make it the very last
row in the group and ADG overall), the systems treats it like I'm trying
to drop it at the node level instead of the child level and throws an
out of bounds (which is probably due to my code that persists the orders
in the database).
In watching it in debugger, here are the values that occur. Here's
the setup:
21 groups (nodes) in the adg.
The last group has 4 children (rows).
If I expand only the last node...and drag the first row of that node
to the next to last row, the adg.dropData.index == 3 and the
adg.dropData.parent == the node object that I am in, which is should
because I am dropping it within that grouping. If I drag the first row
of that node to just below the last row, intending on making it last in
the group, the adg.dropData.index == 25 and the adg.dropData.parent ==
null.
It obvious that the adg doesn't realize that I am dropping it within
the last position of the group because it's the final row in the overall
adg. So I tried to outsmart it. I created a handler to determine if the
adg.dropData.index >= (the hierarchical tree length + the length of the
all the open nodes in the tree), using the assumption that if this is
true, then the user is trying to put the row at the end (keep in mind I
am also checking to make sure it's not a node that is being dragged to
reorder). If this is true, then I manipulate the actual
event.dragInitiator._dropData and the adg.dropData values and force the
index (which I calculate from the number of children in the last node)
and parent information into them.
To a point, this works and my drop is persisted to my database per
design. However, the dropped row disappears from the grid, only
appearing in its correct position on refreshing the grid.
The problem appears in the AdvancedDataGrid.as class.....within the
updateDropData function where calculations are being done to re-place
the row...because the index value is 25, the top and bottom parent
calculations seem to get all jacked up and in the end, the _dropData
gets reset to the old values, completely overriding my efforts to cheat.
Has anyone else ever seen this...know of a way to get around it. It
certainly seems like an Adobe bug to me.
Best,
Adrian