How to sort an XMLList using E4X

//define a new sort array
var sorts : Sort = new Sort();
// create one or more fields to sort one
var field : SortField = new SortField("title",true,false,false);
// add all your fields to the sort fields list
sorts.fields = [ field ];
// define an XMLListCollection ( it contains a sort() method )
var col : XMLListCollection = new XMLListCollection( model.myXML.record as XMLList );
// define which sort fields list to use
col.sort = sorts;
// refresh the datasource
col.refresh();
// set the dataprovider of an e.g. List
listbox.dataProvider = col;

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>