Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex Flex-通过AMF保存水平列表项目的新订单_Apache Flex_Drag And Drop_Horizontallist - Fatal编程技术网

Apache flex Flex-通过AMF保存水平列表项目的新订单

Apache flex Flex-通过AMF保存水平列表项目的新订单,apache-flex,drag-and-drop,horizontallist,Apache Flex,Drag And Drop,Horizontallist,在Flex中,我一直在处理水平列表中项目的拖放。它工作正常,但现在我需要通过AMF在数据库中保存新订单。我很确定这很容易,但我还没弄明白 是否有一种方法可以在对所有项目重新排序后循环,以便我可以为每个项目获取其新索引 我注意到,即使我更改了顺序,数据提供者中的顺序始终是相同的 这是我的清单: <mx:HorizontalList id="horizontalList" allowMultipleSelection="true" allowDragSelection="tru

在Flex中,我一直在处理水平列表中项目的拖放。它工作正常,但现在我需要通过AMF在数据库中保存新订单。我很确定这很容易,但我还没弄明白

是否有一种方法可以在对所有项目重新排序后循环,以便我可以为每个项目获取其新索引

我注意到,即使我更改了顺序,数据提供者中的顺序始终是相同的

这是我的清单:

<mx:HorizontalList id="horizontalList"
    allowMultipleSelection="true"
    allowDragSelection="true"
    dragEnabled="true"
    dropEnabled="true"
    dragMoveEnabled="true"
    labelField="lbl"
    iconField="src"
    itemRenderer="CustomItemRenderer_gallery"
    columnCount="5"
    columnWidth="125"
    rowHeight="125"
    horizontalScrollPolicy="on"
    doubleClickEnabled="true"
    click="{click(event);}"
    dragDrop="handleBtnReorder(event)"
    doubleClick="doubleClick(event);" />

我只是在列表数据提供程序中循环,您将项目拖到其中。。。循环时,将新订单i存储在填充数据提供程序的ArrayCollection中的变量中。。。然后将ArrayCollection转换为要传递到服务器端进行处理的数组

比如:

for(var i:int = 0; i < yourList.dataprovider.length; i++)
{
     yourList.dataProvider.getItemAt(i).order = i;
}
// then convert the ArrayCollection to an Array and pass to your RemoteObject.

我拖动同一列表中的项目,数据提供程序顺序不变。。。我认为存在某种本机方法,甚至是从List类继承的方法。我的错误是,我使用了错误的事件dragDrop。。在dragComplete,数据提供者已经改变,我可以做所有需要的安排:谢谢!