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 8644687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:21:38+00:00 2026-06-12T12:21:38+00:00

I’m having a strange problem. In Flex 4, I have a Spark DataGrid and

  • 0

I’m having a strange problem.

In Flex 4, I have a Spark DataGrid and have both an item renderer and a sort compare function defined for one of the columns. Strangely, this column will not sort in descending order.

The data is originally not sorted. Clicking on the column header displays the “up” arrow and the data sorts in ascending order. However, clicking on the column header again does nothing. The “up” arrow stays and the data stays sorted in ascending order.

I have debugged through the code and found that column.sortDescending in the sort compare function is always false (should this be true when the a descending sort should happen?).

I have Googled this for a long while and searched on here but haven’t found anything.

Anyone have any ideas?

Thanks in advance.

//Edit

Simple Example code:

CreationComplete function initializes data using some random values:

protected function application1_creationCompleteHandler(event:FlexEvent):void
            {
                arrayData = new ArrayCollection();

                var obj:Object;
                for(var i:Number=0; i < 10; i++) {
                    obj = new Object();
                    obj.value1 = i;
                    obj.value2 = Math.floor(Math.random() * (1 + 100 - 1)) + 1;
                    obj.value3 = Math.floor(Math.random() * (1 + 100 - 1)) + 1;

                    arrayData.addItem(obj);
                }
            }

Datagrid defines columns with 4th column having an item renderer and sort compare function defined.

<s:DataGrid x="122" y="142" width="391" height="223" requestedRowCount="4" dataProvider="{arrayData}">
        <s:columns>
            <s:ArrayList>
                <s:GridColumn dataField="value1" headerText="Value 1"></s:GridColumn>
                <s:GridColumn dataField="value2" headerText="Value 2"></s:GridColumn>
                <s:GridColumn dataField="value3" headerText="Value 3"></s:GridColumn>
                <s:GridColumn headerText="Value 3" sortable="true" itemRenderer="ItemRendererTest" sortCompareFunction="sortCompareFunc"></s:GridColumn>
            </s:ArrayList>
        </s:columns>
        <s:typicalItem>
            <fx:Object dataField1="Sample Data" dataField2="Sample Data" dataField3="Sample Data"></fx:Object>
        </s:typicalItem>
    </s:DataGrid>

Item renderer code:

override public function prepare(hasBeenRecycled:Boolean):void {
                var columnString:String = data["value1"] + ":" + data["value2"] + ":" + data["value3"];

                lblData.text = columnString;
            }

Sort compare function:

private function sortCompareFunc(obj1:Object, obj2:Object, col:GridColumn):int {
                var obj1String:String = obj1["value1"] + ":" + obj1["value2"] + ":" + obj1["value3"];
                var obj2String:String = obj2["value1"] + ":" + obj2["value2"] + ":" + obj2["value3"];

                var collator:SortingCollator = new SortingCollator();

                return collator.compare(obj1String, obj2String);
            }
  • 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-12T12:21:39+00:00Added an answer on June 12, 2026 at 12:21 pm

    Just had something similar to this myself seems that the spark grid control needs a dataField defining even though you have a custom sort compare function, simply try adding dataField=”value1″ on your 4th column even though your not going to use it, see if that helps.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.