我需要通过Flex 3.5中的数据网格上的项目编号来排序项目数组。在flex中对数组网格中的点进行排序项目编号
我实际上并不需要在数据网格内重新排序它,我只是需要它在arraycollection上已经排序,然后再发送到数据提供者。
我的问题是,proprety“ITEM_NUMBER”,我需要进行排序这是一个字符串,并将其与批号和一个点,这样构建的:
1.1, 1.2, 1.3, 2.1 , 2.2,3.1 , 3.2,3.3 , 3.4, 3.5,3.6 , 3.7,3.8 , 3.9, 3.10,3.11
我需要它这样的命令。
如果我试图按数字顺序排列它们,3.2大于3.11,所以它不起作用。我需要首先按照点之前的整数排序,然后再按点之后的整数排序,然后再移动到点之前的下一个整数之前
另外我还有另一个问题。 item_number属性位于我的arraycollection上另一个对象内的对象内。
要得到它,我必须:
array_collection.item.item_number
所以总结起来,我需要列出一个属性有序的排列是这样的arrayitem的另一个对象中,它是一个由点分隔的字符串上的数字。
这是我的代码的简化版本:
<mx:Script>
<![CDATA[
public function print_data_grid(array_collection):void
{
my_data_grid.dataProvider = array_collection
}
]]>
</mx:Script>
<mx:DataGrid id="my_data_grid">
<mx:columns>
<mx:DataGridColumn headerText="# Item">
<mx:itemRenderer>
<mx:Component>
<mx:Label toolTip="{this.text}" text="{data.product.item_number}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Item Name">
<mx:itemRenderer>
<mx:Component>
<mx:Label toolTip="{this.text}" text="{data.product.name}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
见http://stackoverflow.com/questions/9429142/how-to-sort-an-arraycollection-in-flex – Brian