Closed ekumar2 closed 2 years ago
`var arr:Array = new ArrayCollection(); arr.push({label:"Z", data:"first"}); arr.push({label:"C", data:"second"}); arr.push({label:"E", data:"third"});
Is arr and Array or an ArrayCollection ? Looks like you are declaring it as an Array and assigning to it an ArrayCollection.
@ekumar2 Can we consider this closed? As Yishay said, this does appear to be invalid:
var arr:Array = new ArrayCollection()
if it was instead:
var arr:Array = [];
arr.push({label:"Z", data:"first"});
arr.push({label:"C", data:"second"});
arr.push({label:"E", data:"third"});
arr.sortOn('label');
...and the results were not correct in this case, then please confirm that is the issue, thanks.
It is ArrayCollection on Updated the information please check.... @greg-dove
I have just confirmed that the ArrayCollection
class in Flex did not have a sortOn()
method. I think that you are mistakenly remembering the sortOn()
method of the Array
class.
`var arr:ArrayCollection = new ArrayCollection(); arr.addItem({label:"Z", data:"first"}); arr.addItem({label:"C", data:"second"}); arr.addItem({label:"E", data:"third"});
arr.sortOn('label');
expected output - {label:"C", data:"second"}; {label:"E", data:"third"}; {label:"Z", data:"first"}; `
The sortOn works on ArrayCollection and it sorts the object of Arrays based on property passed.