1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="Go()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.Sort;
import mx.collections.SortField;
public function Go():void{
var array:Array = new Array(
{test:"2eme petit test"},
{test:"1er test"},
{test:"@"}
);
var collection:ArrayCollection = new ArrayCollection(array);
machin.dataProvider = collection;
//a partir d'ici il y a un traffiquage a faire pour que le "@" s'affiche en tout premier mais je connais aucun tuto qui donne l'info
var sortCount:Sort = new Sort();
sortCount.fields= [new SortField('test', true)];
collection.sort = sortCount;
//...fin du sort
}
]]>
</mx:Script>
<mx:DataGrid id="machin" x="297" y="84" height="376">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="test"/>
</mx:columns>
</mx:DataGrid>
</mx:Application> |
Partager