Re: Specific sorting, then alphabetic

2013-02-28 Thread Shervin Asgari
Thanks all. I have solved the issue. The error seemed to be from this line: return fields.getItemIndex(a) - fields.getItemIndex(b); Somehow it didn't get the index right. I changed it to do a normal alpabetic search in those cases, and it worked. Shervin 2013/2/27 Justin Mclean > Hi, > > It

Re: Specific sorting, then alphabetic

2013-02-27 Thread Justin Mclean
Hi, It may be theres an issue at this line unless your code you posted is incomplete: var grunner:ArrayCollection = //getting collection After this line is there anything in the grunner array? Add trace statements or run though a debugger to see what the issues is would be the simple way to fi

Re: Specific sorting, then alphabetic

2013-02-27 Thread Shervin Asgari
If you look at here: http://stackoverflow.com/questions/1368122/flex-sort-writing-a-custom-comparefunction There they both use the Sort and compareFunction. Thats what I am trying to accomplish. I am trying to do a custom sort, then alphabetic. 2013/2/27 Tom Chiverton > I meant > > grunner.sor

Re: Specific sorting, then alphabetic

2013-02-27 Thread Tom Chiverton
I meant grunner.sort.fields = [new SortField("code")];// Sort grunner.sort.compareFunction = myCompare;//compareFunction If your IDE has given up, just add some trace() statements. There's a method in ObjectUtil that'll dump Array (well, anything) sensibly. Tom On 27/02/2013 08:55, S

Re: Specific sorting, then alphabetic

2013-02-27 Thread John Cunliffe
Not sure why you are implementing your own compare. Instead I would add an integer sort property to your code object, where the specified order is reflected. Of your n specially sorted objects, each gets 1...n value, all the remaining being sorted elsewhere get n+1. Then you use multiple sortfields

Re: Specific sorting, then alphabetic

2013-02-27 Thread Shervin Asgari
What do you mean sort and compareFunction? The reason why its empty is because for some reason an error occurs, and my Intellij doesn't print out the error messages. So its difficult for me to know exactly what went wrong. The array is not empty, and the objects are not null. Shervin 2013/2/27 T

Re: Specific sorting, then alphabetic

2013-02-27 Thread Tom Chiverton
I wouldn't give a Sort and a compareFunction - what's the point ? Just have one or the other. Either way, this wont empty your ArrayCollection. If you dump it out before and after var grunner:ArrayCollection along with where ever it came from, are your *sure* it isn't being populated by an

Specific sorting, then alphabetic

2013-02-27 Thread Shervin Asgari
Hi. I am very very new to Flex. I created this thread for sorting in Java http://stackoverflow.com/q/15091732/37298 However, I am now trying to do the same thing in ActionScript. I have a Bindable ArrayCollection with Objects that looks like this Code.code : F Code.label: Foo Code.description: