You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Jan Weber (Jira)" <ji...@apache.org> on 2022/02/21 10:29:00 UTC
[jira] [Commented] (FLEX-34741) Spark DataGrid Drag and Drop non functioning
[ https://issues.apache.org/jira/browse/FLEX-34741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17495445#comment-17495445 ]
Jan Weber commented on FLEX-34741:
----------------------------------
If anyone encounters the same problem, the solution worked fine with the attached DataGrid AS Class _but_ you need to also override the function "{*}destroyDropIndicator{*}".
As stated above:
"{_}All the drag handlers in DataGrid need to call showDropIndicator(), hideDropIndicator(), and destroyDropIndicator() on the GridViewLayout, not the GridLayout.{_}"
Since the attached class does not contain an _override_ to the *destroyDropIndicator* function, it will cause a null-pointer in the base class when it tries to access "{*}_gridViewLayout.dropIndicator{*}".
{{The override looks like:}}
{{ override public function destroyDropIndicator():DisplayObject}}
{{ {}}
{{ var gridViewLayout : GridViewLayout = GridViewLayout(GridLayout(grid.layout).centerGridView.layout);}}
{{ var dropIndicatorInstance:DisplayObject = gridViewLayout.dropIndicator;}}{{ if (!dropIndicatorInstance)}}
{{ return null;}}{{ // Release the reference from the layout}}
{{ gridViewLayout.dropIndicator = null;}}{{ // Release it if it's a dynamic skin part}}
{{ var count:int = numDynamicParts("dropIndicator");}}{{ for (var i:int = 0; i < count; i++)}}
{{ {}}
{{ if (dropIndicatorInstance == getDynamicPartAt("dropIndicator", i))}}
{{ {}}
{{ // This was a dynamic part, remove it now:}}
{{ removeDynamicPartInstance("dropIndicator", dropIndicatorInstance);}}
{{ break;}}
{{ }}}
{{ }}}{{ return dropIndicatorInstance;}}
{{ }}}
> Spark DataGrid Drag and Drop non functioning
> --------------------------------------------
>
> Key: FLEX-34741
> URL: https://issues.apache.org/jira/browse/FLEX-34741
> Project: Apache Flex
> Issue Type: Bug
> Components: Spark: DataGrid
> Affects Versions: Apache Flex 4.14.0
> Reporter: Devin
> Assignee: Mark Kessler
> Priority: Major
> Labels: drag&drop
> Fix For: Apache Flex 4.15.0
>
> Attachments: DragDropGrid.as
>
>
> Description
> Dropping a dragged item onto the grid does not work. When calculating the DropLocation (in dragEnter, dragOver, dragDrop handlers) it falls through to LayoutBase.calculateDropIndex which simply executes "return target.numElements;" That's clearly not how the dropIndex should be calculated on the grid. The GridLayout class should be overriding this method and calculating it correctly.
> Furthermore, upon trying to fix this issue (which is more complicated than it should be because DataGrid.calculateDropPosition() is marked as private) the DataGrid.calculateDropPosition() does not perform a null check on the DropLocation (which is valid value).
> Steps to Reproduce
> 1. Create a DataGrid with dragEnabled, dragMoveEnabled, and dropEnabled all set to true.
> 2. Try dragging rows around and dropping them.
> Environment
> Windows 8, Apache Flex 4.14
> Expected Behavior
> Seeing the drop indicator.
> The expected behavior of dragging a row and dropping it in another location.
> Actual Behavior
> No drop indicator. Dropping a row does nothing.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)