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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:59:31+00:00 2026-05-28T02:59:31+00:00

Introduction: I have an AdvancedDataGrid displaying hierarchical data illustrated by the image below: The

  • 0

Introduction:
I have an AdvancedDataGrid displaying hierarchical data illustrated by the image below:
enter image description here

The branch nodes “Prosjekt” and “Tiltak” display the sum of the leaf nodes below.

Problem: I want the root node “Tavle” to display the total sum of the branch nodes below. When i attempted to do this by adding the same SummaryRow the sum of the root node was not calculcated correctly(Every node’s sum was calculated twice).

dg_Teknikktavles = new AutoSizingAdvancedDataGrid();
            dg_Teknikktavles.sortExpertMode="true";
            dg_Teknikktavles.headerHeight = 50;
            dg_Teknikktavles.variableRowHeight = true;

            dg_Teknikktavles.addEventListener(ListEvent.ITEM_CLICK,dg_TeknikktavlesItemClicked);
            dg_Teknikktavles.editable="false";
            dg_Teknikktavles.percentWidth=100;
            dg_Teknikktavles.minColumnWidth =0.8;
            dg_Teknikktavles.height = 1000;
            var sumFieldArray:Array = new Array(context.brukerList.length);

            for(var i:int = 0; i < context.brukerList.length; i++)
            {
            var sumField:SummaryField2 = new SummaryField2();
            sumField.dataField = Ressurstavle.ressursKey + i;
            sumField.summaryOperation = "SUM";
            sumFieldArray[i] = sumField;
            }

            var summaryRow:SummaryRow = new SummaryRow();
            summaryRow.summaryPlacement = "group";
            summaryRow.fields = sumFieldArray;

            var summaryRow2:SummaryRow = new SummaryRow();
            summaryRow2.summaryPlacement = "group";
            summaryRow2.fields = sumFieldArray;

            var groupField1:GroupingField = new GroupingField();
            groupField1.name = "tavle";
            //groupField1.summaries = [summaryRow2];

            var groupField2:GroupingField = new GroupingField();
            groupField2.name = "kategori";
            groupField2.summaries = [summaryRow];
            var group:Grouping = new Grouping();
            group.fields = [groupField1, groupField2];
            var groupCol:GroupingCollection2 = new GroupingCollection2();
            groupCol.source = ressursTavle;
            groupCol.grouping = group;
            groupCol.refresh();

Main Question: How do i get my AdvancedDataGrid’s (dg_Teknikktavles) root node “Tavle” to correctly display the sum of the two branch nodes below?

Side Question: How do i add a red color to the numbers of the root node’s summary row that exceed 5? E.g the column displaying 8 will exceed 5 in the root node’s summary row, and should therefore be marked red

Thanks in advance!

  • 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-28T02:59:32+00:00Added an answer on May 28, 2026 at 2:59 am

    In case someone else has the same problem:

    The initial problem that everything was summed twice, was the result of using the same Array of SummaryField2 (sumFieldArray in the code) for both grouping fields(GropingField2 tavle and kategori)

    The Solution to the main question: was to create a new array of summaryfields for the root node(in my intial for loop):

        //Summary fields for root node
        var sumFieldRoot:SummaryField2 = new SummaryField2();
        sumFieldRoot.dataField = Ressurstavle.ressursKey + i;
        sumFieldRoot.summaryOperation = "SUM";
        sumFieldArrayRoot[i] = sumFieldRoot;
    

    Answer to the side question:
    This was pretty much as easy as pointed out by wvxyw. Code for this solution below:

            private function summary_styleFunction(data:Object, col:AdvancedDataGridColumn):Object
            {
                var output:Object;
                var field:String = col.dataField; 
                if ( data.children != null )  
                {  
                    if(data[field] >5){
                        output = {color:0xFF0000, fontWeight:"bold"}
                    }
                    else {
                        output = {color:0x006633, fontWeight:"bold"}
                    }
                    //output = {color:0x081EA6, fontWeight:"bold", fontSize:14}
    
                }  
    
    
                return output;  
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on the introduction on the link below and have been
Introduction I have been so annoyed by applications that have a startup dialog which
Introduction We have an OpenID Provider which we created using the DotNetOpenAuth component. Everything
I have a section: \section{Introduction} \label{sec:introduction} I'd like a link to the section where
Introduction In my current organisation, we have many desktop and web applications all feeding
I'm looking for an online introduction to unit testing and TDD. I have virtually
Introduction I have a ListView and want to format only the second column. The
Introduction to the problem I have been taught about OO Analysis and Design through
I have code such as void myfunc() { introduction(); while(condition()) { complex(); loop(); interior();
i have following problem from book introduction algorithm second edition by MIT university problem

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.