Help - Grouping - Aggregate Column Total

4 posts, 0 answers
  1. Jim
    Jim avatar
    52 posts
    Member since:
    Apr 2009

    Posted 01 Sep 2009 Link to this post

    I am sure I have coded something incorrectly but I am incapable of figuring it out:

    The code I am about to post exhibits the following problems:
    1) Column totals don't show up at all
    2) Footer is not right justified ( in the grand total that does show up )

    I have loaded and inspected the example Vlad posted here: SilverlightApplication2 and the application works just fine for me.  I have to be missing some key component but I just cannot discover it.

    Here is the grid XAML:
    <telerikGridView:RadGridView AutoGenerateColumns="False" x:Name="cGrid"  
                                ShowGroupPanel="False"  
                                CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed"  
                                ShowGroupFooters="True" ShowColumnFooters="True"
        <telerikGridView:RadGridView.Columns> 
            <telerikGridView:GridViewDataColumn HeaderText="Asset" UniqueName="AssetName" Width="200" /> 
            <telerikGridView:GridViewDataColumn HeaderText="Cusip" UniqueName="Cusip" Width="Auto"/> 
            <telerikGridView:GridViewDataColumn HeaderText="Shares" UniqueName="Shares" Width="Auto" TextAlignment="Right" /> 
            <telerikGridView:GridViewDataColumn HeaderText="MarketValue" UniqueName="MarketValue" Width="Auto" TextAlignment="Right" /> 
        </telerikGridView:RadGridView.Columns> 
        <telerikGridView:RadGridView.GroupDescriptors> 
            <telerikData:GroupDescriptor Member="ReportType" SortDirection="Ascending" /> 
        </telerikGridView:RadGridView.GroupDescriptors> 
    </telerikGridView:RadGridView> 

    And here is where I actually create the aggregate functions and assign their properties:
        foreach (var externalColumn in e.Result.ExternalDataColumns) 
        { 
            switch (externalColumn.ColumnName.ToLower()) 
            { 
                case "marketvalue": 
                    { 
                        var col = cGrid.Columns["MarketValue"] as GridViewDataColumn; 
                        Debug.Assert( col != null, "Columns[MarketValue] is null."); 
                        if ( col != null ) 
                        { 
                            var sum = new SumFunction(); 
                            sum.ResultFormatString = externalColumn.FormatString; 
                            sum.SourceField = "MarketValue"
                             
                            col.DataFormatString = externalColumn.FormatString; 
                            col.FooterTextAlignment = TextAlignment.Right; 
                            col.AggregateFunctions.Add( sum ); 
                        } 
                    } 
                    break; 
                case "shares": 
                    { 
                        var col = cGrid.Columns["Shares"] as GridViewDataColumn; 
                        Debug.Assert(col != null, "Columns[Shares] is null."); 
                        if (col != null) 
                        { 
                            var sum = new SumFunction(); 
                            sum.ResultFormatString = externalColumn.FormatString; 
                            sum.SourceField = "Shares"
     
                            col.DataFormatString = externalColumn.FormatString; 
                            col.FooterTextAlignment = TextAlignment.Right; 
                            col.AggregateFunctions.Add(sum); 
                        } 
                    } 
                    break; 
     
            } 
        } 

    That is about it for the entire user control other than showing how I got the data back from the wcf server.

    Here is what I get displayed: Grid Snapshot


  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Sep 2009 Link to this post

    Hello Jim,

    I've made for you small example project to illustrate you how to achieve this - unfortunately you are right about the alignment issue and we will do our best to include fix for this in our next internal build (next week).

    Please check the attachment and let me know how it goes.

    Greetings,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Thomas LEBRUN
    Thomas LEBRUN avatar
    66 posts
    Member since:
    Sep 2009

    Posted 09 Nov 2009 Link to this post

    Hi Vlad,

    Do you know if the alignment issue is still active in the last version of the controls ? Because i'm still having the problem....


    Thanks !
  5. Kalin Milanov
    Admin
    Kalin Milanov avatar
    447 posts

    Posted 12 Nov 2009 Link to this post

    Hello Thomas LEBRUN,

    Unfortunately this fix proved more complicated that we originaly thought. We are currently working on it and are hopeful we will have a solution soon.

    I apologize for the inconvenience caused.

    Greetings,
    Kalin Milanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top