开发者

Update hierarchical data provider in advanced data grid during drag and drop

开发者 https://www.devze.com 2023-01-24 06:19 出处:网络
I am trying to drag and drop hierarchical data in the same advanced data grid, and I would like the data provider to updated when the ADG is updated. (I want to be able to save and load this tree, so

I am trying to drag and drop hierarchical data in the same advanced data grid, and I would like the data provider to updated when the ADG is updated. (I want to be able to save and load this tree, so it is important that drags and drops are saved.)

I have a sample application (with view source enabled) posted here: www.crcarlson.com/adg/AdvancedDataGridDragAndDrop.swf

The sample app has an ADG showing hierarchical data as well as flat data. The first column of each datagrid shows the rowindex of the underlying data.

If you rearrange the items on the left ADG, the row indexes become unordered. If you click traceTree you see that the data provider is not in order.

On the other hand if you do the same on the right, the row numbers stay ordered even when the objects move around and if you click traceFlat, the data provider is in the order shown on ADG

My goal is to have the data provider order match the ADG order for the lef开发者_StackOverflowt grid which is displaying hierarchical data.

I would appreciate any advice on this, including "you can't get there from here, do it this way."


I noticed a few things while perusing your code and using the app:

  • Use an ArrayCollection instead of Array as the dataProvider for a view component whose data changes. This might solve your update problems.
  • If implementing an ArrayCollection doesn't completely solve your update problems, add the necessary logic to a dragDrop or dragComplete event handler.
  • I get a runtime error every time I drag an item from adg to adgFlat.

Here's Adobe's take on Using Drag and Drop. Specifically check out the last page titled "Moving and copying data". Good luck to you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号