[flexcoders] Custom Collection Sorting
Hi, I've got a problem where I need to sort a collection to match another collection's ordering. The ordering isn't standard like 1,2,3,4 our A,B,C but like 9,1,2,8,4,6 So in the unsorted collection would be ordered 1,2,3,4 but the sorted collection would be a custom ordering (which is ad hoc as determined by the user. I've been poring over docs and posts and trying to come up with a solution, but so far no dice. Any assistance appreciated!!! Jeff
RE: [flexcoders] Custom Collection Sorting Challenge
Create a temporary array, add data there using push() and then assign in to fields property. tmpArray:Array = new Array(); tmpArray.push(sfSortField); tmpArray.push(sfLevel); aSort.fields = tmpArray; Cheers, Alex -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of iko_knyphausen Sent: Wednesday, February 28, 2007 11:04 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Custom Collection Sorting Challenge Hi all, more questions on custom collection sorting... I have a XMLListCollection dataprovider, which I am sorting using a sort object. The sorting works as expected, when I use the following syntax to define the array of SortFields: aSort.fields = [sfSortField, sfLevel]; However, I would like to assemble the fields array dynamically, depending on column position, or what have you, so my first thought was to use the array.push() method to add the individual SortFields, but this fails without an exception being thrown... i = aSort.fields.push(sfSortField); i = aSort.fields.push(sfLevel); Any ideas? Thanks
[flexcoders] Custom Collection Sorting Challenge
Hi all, more questions on custom collection sorting... I have a XMLListCollection dataprovider, which I am sorting using a sort object. The sorting works as expected, when I use the following syntax to define the array of SortFields: aSort.fields = [sfSortField, sfLevel]; However, I would like to assemble the fields array dynamically, depending on column position, or what have you, so my first thought was to use the array.push() method to add the individual SortFields, but this fails without an exception being thrown... i = aSort.fields.push(sfSortField); i = aSort.fields.push(sfLevel); Any ideas? Thanks