Solved

Flex 3 AdvancedDataGrid Sort

Posted on 2011-02-16
1
368 Views
Last Modified: 2012-05-11
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



0
Comment
Question by:RenAndStimpy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 total points
ID: 34906009
Well propably your list of products is a plain ArrayCollection. If this is the case you could initialize every one of these lists with a sorting function. Another alternative would be to use a custom dataProvider (by extending GroupingCollection or something similar).
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adobe flash player fails to install 12 318
How  to reduce the .AVI file size of 90GB 4 370
Adobe Flash player - Microsoft Edge 9 180
embedding a media live encoder stream 3 158
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question