我需要通過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