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

  • Home
  • SEARCH
  • 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 3362232
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:14:57+00:00 2026-05-18T03:14:57+00:00

I have am using an mx:advanceddatagrid and I running into a problem with grouped

  • 0

I have am using an mx:advanceddatagrid and I running into a problem with grouped column sorting. A screenshot of what my grid looks like is here: https://i.stack.imgur.com/waAi7.png

I have the following kind of data:

PRODUCT_ID PROD_NAME CATEGORY TYPE SubType SubType_descr

1             p_1          c1_y          t1
                                              t1_s1      sub_1*
                                              t1_s2      sub_2*
                                              t1_s4      sub_4* 
                                              t1_s5      sub_5* 

2             p_2          c1_x          t1
                                               t1_s1      sub_1
                                               t1_s2      sub_2
                                               t1_s3      sub_3

3             p_3          c1_x          t1
                                               t1_s1      sub_1
                                               t1_s2      sub_2*
                                               t1_s3      sub_3*

Now, the dataset is of the type arrayCollection. I manually move it into GroupingCollection2 when a setter fires the Binding Event;

protected function setGrouping(columnNames:Array):void{
                _groupingColumns = [];


                if (columnNames.length > 0) {
                    var _groupedData:GroupingCollection2 = new GroupingCollection2();
                    var _grouping:Grouping = new Grouping();

                    for (var i:int=0;i<columnNames.length;i++) {
                        var gc:GroupingField = new GroupingField(columnNames[i]);
                        _groupingColumns.push(gc);
                    }
                    _groupedData.source = _ds;
                    _grouping.fields = _groupingColumns;
                    _groupedData.grouping = _grouping
                    _groupedData.refresh();
                    _data = _groupedData;
                } else {
                    _data = _ds;
                }

                setGridColumns();
            }

Although I am grouping on Product_Id, i achieve the above look by a labelFunction as shown below:

col.labelFunction = function (item:Object,column:AdvancedDataGridColumn):String {
                            if (item.hasOwnProperty('GroupLabel') && item.GroupLabel != null) {
                                if (item.children.length > 0) {
                                    return item.children[0][column.dataField];
                                }
                                else {
                                    return "";
                                }
                            }   
                            else {
                                return "";
                            }       
                        }

The data I recieve from the server is of the kind shown below

    PRODUCT_ID    PROD_NAME    CATEGORY    TYPE    SubType    SubType_descr
-------------------------------------------------------------------
    1             p_1          c1_y          t1    t1_s1      sub_1*
    2             p_2          c1_y          t1    t1_s2      sub_2*
    3             p_3          c1_y          t1    t1_s3      sub_3*
-------------------------------------------------------------------
    4             p_4          c1_x          t1    t1_s1      sub_1*
    5             p_5          c1_x          t1    t1_s2      sub_2*
    6             p_6          c1_x          t1    t1_s3      sub_3*

In short I am taking all the common column values (Product, Category, Type) and putting them in the first row, all the changing values in the sub-rows (sub_type, subtype_descr)

I would like to sort this gird on Prod_Name, Category and type columns as well but sonething like the following is not working, even though the underlying data gets sorted.

public var _sort_direction:Boolean = false;
            protected function adg1_headerReleaseHandler(event:AdvancedDataGridEvent):void
            {

                var sort:Sort = new Sort();
                    sort.fields = [new SortField(event.dataField, true, _sort_direction)];

                    _ds.sort = sort;
                    _ds.refresh();

                    if (DefaultGroupColumn != null && temp[0] != DefaultGroupColumn) {
                        temp.push(DefaultGroupColumn);
                    }


                    setGrouping(temp);

                    adg1.validateNow();
                    _sort_direction = !_sort_direction;
            }

all help is really appreciated.

  • 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-05-18T03:14:57+00:00Added an answer on May 18, 2026 at 3:14 am

    The answer to this was so simple, but Adobe documentation and some other blogs sent me on a wild goose chase…

    for (var i:int=0;i<columnNames.length;i++) {
                            var gc:GroupingField = new GroupingField(columnNames[i]);
                                gc.compareFunction = positionCompareFunction;
                                gc.descending = sort_dir;
                            _groupingColumns.push(gc);
                        }
    

    A colleague (thanks Samitt) helped me figure this out. Just add gc.descending and the grouping will sort on the grouped column.

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

Sidebar

Related Questions

I have using a basic DataContext to create objects then submit these into a
I have using Silverlight and Caliburn Micro and am having a problem getting child
I have using colobox which is a jquery modal window to create a login/regiestration
I have using VPS that had to be re-imaged. my DB was part of
I have using cakephp and I want to obscure all numbers which is more
I have using jsp technology in my project.I want to do session tracking in
Almost all C# files have using statements at the top of the page i.e.
I have a process that extracts customer info from multiple databases (MySql) based on
I have a process that extracts customer info from multiple databases (MySql) based on

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.