Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8491153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:19:57+00:00 2026-06-10T22:19:57+00:00

I have a list of items in an ArrayCollection that I’d like sorted by

  • 0

I have a list of items in an ArrayCollection that I’d like sorted by a certain value (not alphabetical). Is it possible to sort this way?

Here are the values I want to be ordered by:

Resolved
Closed
Open

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In Addition to the provided answer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If your array collection is part of a DataGrid then you can set the sortCompareFunction on the DataGrid’s GridColumn. Note that the syntax is different for this sort compare function as the grid colummn is passed in rather than the fields.

EXAMPLE CODE
used with a Spark DataGrid

        private var desiredItemOrder:Array = ["In Progress", "Open", "Resolved", "Closed"];

        private function sortCompareFunction(item:Object, anotherItem:Object, column:GridColumn = null):int
        {
            var itemIndex:Number = desiredItemOrder.indexOf(item.fields.status.name);
            var anotherItemIndex:Number = desiredItemOrder.indexOf(anotherItem.fields.status.name);

            if (itemIndex == -1 || anotherItemIndex == -1)
                throw new Error("Invalid value for criticality ");
            if (itemIndex == anotherItemIndex)
                return 0;
            if (itemIndex > anotherItemIndex)
                return 1;
            return -1;
        }


        <s:DataGrid dataProvider="{issuesCollection}">
            <s:columns>
                <s:ArrayList>
                    <s:GridColumn dataField="fields.status.name" headerText="Status" sortCompareFunction="sortCompareFunction"/>
                </s:ArrayList>
            </s:columns>
        </s:DataGrid>

DOCUMENATION
Sort compareFunction
DataGridColumn sortCompareFunction
GridColumn sortCompareFunction

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:19:59+00:00Added an answer on June 10, 2026 at 10:19 pm

    this may be of some help to you

    Sorting an ArrayCollection in Flex

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within my code I have list items like this; <div id=content> <ul class=kwicks> <li
i have list of items IList with data that looks list this: GenId TestMode
I have select list items looking like this: <option>- Data source A -</option> <option>-
I have a list items of cars that I'd like to animate through. <li
I have a list of items, like a menu, where the current item has
I have a list of items on my web page that the user can
I have list items in an unordered list that when double clicked, can be
I have list items that displayed inline. I want to align them vertically inside
I have list of items that need to be processed and printed to the
I have list of items with check boxes using this code: ProcessList = (ListView)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.