This content has been marked as final. Show 4 replies
I think you best bet is to put your xml into an arraycollection and then you can sort by the order field. Then use the arraycollection as your datagrid provider.
Ok, I have done that, but what I am trying to do is to sort the columns order, not the rows. Flex by default sort them alphabetically.
Many thanks for your answer, anyway!
Another question, maybe you can help me! If I put the xml into an arrayCollection, how do I retrieve the name of the node? I am able to retrieve the content and attributes, but I would like to know if it is possible to retrieve the name of the node.
how do i retrieve the part "book_name"?
Many thanks again!
You can try explicitly defining your DataGridColumns, like this:
<mx:DataGridColumn headerText="Book Name" dataField="book_name"/>
<mx:DataGridColumn headerText="Order" dataField="order"/>
<mx:DataGridColumn headerText="Other Field" dataField="other"/>
That should give you the control to order your columns however you want to, and also, to only include what columns you want included.
If that doesn't work, then I may not be understanding your problem correctly.