R – flex: drag-drop problem

apache-flexdrag and drop

I have two Lists that both are drag-drop enabled.

I also draw a chart according the items in the second list and trigger drawChart method whenever a drag-drop event occurs between them.

Drag drop and dynamic charting work properly except one problem.

I put dragComplete="drawChart()" to both of lists.
Dragging from first list to second refreshes the chart properly as I expected.

But while dragging from second to first list; I have problem: in drawChart method it is seen that dragged-out element is still on second list. So chart is refreshed with one time past data.

I tried changing dragComplete event with dataChange, change, dragExit but all have problems.

I hope I explained this complicated situation clearly.

Thanks in advance;

And as a last notew here is the "two list":

<mx:HBox>
    <mx:Panel id="panelAS" styleName="opaquePanel" title="Available Series">
        <mx:List id="listAS"
                dataProvider="{asData}"
                dropEnabled="true" 
                dragEnabled="true"
                dragComplete="drawChart()"
                dragMoveEnabled="true"
                doubleClickEnabled="true"
                doubleClick="moveToDest(event)" 
                rowCount="6">
        </mx:List>
    </mx:Panel>

    <mx:Panel id="panelSS" styleName="opaquePanel" title="Selected Series" >
        <mx:List id="listSS"
                dropEnabled="true"
                dragEnabled="true"
                dragMoveEnabled="true"
                dragComplete="drawChart()"
                doubleClickEnabled="true"
                doubleClick="moveToSrc(event)"
                rowCount="6">
        </mx:List>
    </mx:Panel>
</mx:HBox>

Best Answer

Solution: I have put a delay with Timer for drawChart so wait drag-drop completes before drawChart.

Related Topic