Link to home
Start Free TrialLog in
Avatar of RenAndStimpy
RenAndStimpyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Flex 3 AdvancedDataGrid Sort

I have an advanced datagrid display product information with a main category, sub category and then a list of products within that category.

Problem that I have is that all the product within the category are in a random order and even tho they are in order from the cfc, when outputted in the datagrid they are random.

I'm thinking this needs a sortCompare function but i'm not sure how to implement this into my code.  Any help be appriciated.

Heres the code for my results function:

public function resultGetSubmissionsByCategory(event:ResultEvent):void {
				
	               //results returned by the ColdFusion CFC are a query
	               //which can be cast to a Flex ArrayCollection object
	               submissionsAryCol = event.result as ArrayCollection;
				   submissionsAryCol.filterFunction = filterArrayLike;
	               
	               //convert the ArrayCollection to a GroupingCollection
	               var submissionsNameGroup:Grouping = new Grouping();
	               
	               //what column in the query results should be used to group on
	               var nameGroupFld1:GroupingField = new GroupingField("parentCategory") ;
	               var nameGroupFld2:GroupingField = new GroupingField("categoryDescription") ;
	               //set the fields property of the Grouping 
	               //to an array of GroupingField objects
	               submissionsNameGroup.fields = [ nameGroupFld1, nameGroupFld2 ];
	               
	               submissionsGroupColl =  new GroupingCollection();
	               
	               //set the source property of the GroupingCollection
	               //to the flat data ArrayCollection
	               submissionsGroupColl.source = submissionsAryCol;
	               
	               //set the grouping property of the GroupingCollection
	               //to the Grouping object that contains the fields
	               //to group the data on
	               submissionsGroupColl.grouping = submissionsNameGroup;
	               
	               //call refresh so the view is updated
	               submissionsGroupColl.refresh();	   
			}

Open in new window



ASKER CERTIFIED SOLUTION
Avatar of ChristoferDutz
ChristoferDutz
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial