Group Footer Auto Aggregate on Cell Commit

9 posts, 0 answers
  1. Hrushikesh
    Hrushikesh avatar
    33 posts
    Member since:
    Sep 2010

    Posted 06 Sep 2010 Link to this post

    How can be the group footer aggregate be updated?
    When we edit any cell and go to other cell of the same row, it doesn't update the aggregate on the footer. When we go to other row it update the footer aggregate.

    How can we make the aggregate update automatically after cell edit commit, not on row edit commit?

    Thanks
    Hrushikesh Patel
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 07 Sep 2010 Link to this post

    Hi Hrushikesh,

    You may try to handle the CellEditEnded event of RadGridView and call the CalculateAggregates() method. For example:
    private void playersGrid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
    {
        this.playersGrid.CalculateAggregates();    
    }



    Greetings,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Hrushikesh
    Hrushikesh avatar
    33 posts
    Member since:
    Sep 2010

    Posted 08 Sep 2010 Link to this post

    Thank You, Code is working properly.
  4. Sumit
    Sumit avatar
    7 posts
    Member since:
    Jul 2010

    Posted 01 Oct 2010 Link to this post

    Hello Maya,

    Now we are having another but very similar issue. If we performed grouping and change any cell value, on Lost focus it successfully update the group footer but again we are not having each row footer at the same time, however while we click on another row, it updates the row footer correctly. Please find attached screen for better understanding.

    Please suggest what we need to do in order to update each row footer at the same time.

    Thanks,

    Sumit
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 01 Oct 2010 Link to this post

    Hi Sumit,

    Unfortunately, I am not quite capable of understanding your exact scenario. Please, provide a bit more specifics about the steps you are making and the desired/undesired behavior of the aggregate functions.
     

    Regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Sumit
    Sumit avatar
    7 posts
    Member since:
    Jul 2010

    Posted 04 Oct 2010 Link to this post

    Hello Maya,

    Previously you suggested that we need to add CalculateAggregates() on CellEditEnded event and it was working. But If we have applied grouping on that Grid and we have added Group Row Footer, its not working for GroupRowFooter.

    private void playersGrid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
    {
        this.playersGrid.CalculateAggregates();    
    }


    Below you can see the code used for binding and implementing the functionality of changing the grouped-by element.


            private void OnLoaded(object s, RoutedEventArgs e)
            {
                this.dayColumns = this.CreateDayColumns();
                this.CreateGroup(ClientFullNameLabel, ClientLabel);
              }  

     

    private IEnumerable<GridViewColumn> CreateDayColumns()
            {
                 var temp = new List<GridViewColumn>();

     

                foreach (var gridColumn in from column in ((IDayColumnsViewModel)this.ViewModel).DayColumns
                                           select new RadNumericUpDownColumn()
                                           {
                                               IsVisible = column.IsVisible,
                                               Header = column.Header,
                                               DataMemberBinding = new Binding(column.BoundPropertyName),
                                               IsFilterable = false,
                                               IsGroupable = true,
                                               UniqueName = column.UniqueName,
                                               CellTemplateSelector = new DayCellDataTemplateSelector(column.BoundPropertyName)
                                           })
                {
                    SumFunction sumFunction = new SumFunction();
                    sumFunction.SourceField = gridColumn.UniqueName;
                    sumFunction.ResultFormatString = "{0:f2}";
                    gridColumn.AggregateFunctions.Add(sumFunction);
                    this.grdView.Columns.Add(gridColumn);
                    temp.Add(gridColumn);
                }

                return temp;
            }   

     private void GroupByComboSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
            {
                // Combo selection occured before the grid was ready
                if (this.grdView == null) return;

                var item = (RadComboBoxItem)e.AddedItems[0];
                var member = string.Empty;
                var displayContent = string.Empty;

                switch (item.Content.ToString())
                {
                    case ClientLabel:
                        member = ClientFullNameLabel;
                        displayContent = ClientLabel;
                        break;
                    case FundIdentifierLabel:
                        member = FundIdentifierUuidLabel;
                        displayContent = FundIdentifierLabel;
                        break;
                    case ServiceLabel:
                        member = ServiceUuidLabel;
                        displayContent = ServiceLabel;
                        break;
                }

                if (member == string.Empty)
                {
                    //Remove grouping
                    this.grdView.GroupDescriptors.Clear();
                }
                else
                {
                    // Adds grouping to the grid
                    this.CreateGroup(member, displayContent);
                }
            }

            private void CreateGroup(string member, string displayContent)
            {
                this.grdView.GroupDescriptors.Clear();

                var descriptor = new Telerik.Windows.Data.GroupDescriptor();
                descriptor.Member = member;
                descriptor.SortDirection = ListSortDirection.Ascending;
                descriptor.DisplayContent = displayContent;

               
                AggregateFunction func = new SumFunction { SourceField = "TotalUnits", ResultFormatString = "Total units: {0:f}" };
                descriptor.AggregateFunctions.Add(func);
                var column = this.grdView.Columns["TotalUnits"];
                column.AggregateFunctions.Clear();
                column.AggregateFunctions.Add(func);

                func = new CountFunction { ResultFormatString = "Total clients: {0}" };
                descriptor.AggregateFunctions.Add(func);
                column = this.grdView.Columns["ClientFullName"];
                column.AggregateFunctions.Clear();
                column.AggregateFunctions.Add(func);

     

    foreach

     

     

    (var item in this.grdView.Columns.Where<GridViewColumn>(c => c.UniqueName != null && c.UniqueName.StartsWith("Day")))

     

    {

     

     

    SumFunction sumFunction = new SumFunction();

     

    sumFunction.SourceField = item.UniqueName;

    sumFunction.ResultFormatString =

     

    "{0:f2}";

     

    descriptor.AggregateFunctions.Add(sumFunction);

    item.AggregateFunctions.Clear();

    item.AggregateFunctions.Add(sumFunction);

    }

     

     

                this.grdView.GroupDescriptors.Add(descriptor);
            }

     

                    <r:RadGridView.Columns>
                        <r:GridViewDataColumn Header="Client" DataMemberBinding="{Binding Path=ClientFullName}" UniqueName="ClientFullName" IsReadOnly="True" >
                            <r:GridViewDataColumn.AggregateFunctions>
                                <telerik:CountFunction ResultFormatString="{}Total clients: {0}" />
                            </r:GridViewDataColumn.AggregateFunctions>
                        </r:GridViewDataColumn>
                       
                        <local:RadNumericUpDownColumn Header="Total Units" DataMemberBinding="{Binding Path=TotalUnitsUi, Mode=TwoWay}"   CellTemplateSelector="{StaticResource itemModifiedSelector}" UniqueName="TotalUnits" IsFilterable="False">
                            <local:RadNumericUpDownColumn.AggregateFunctions>
                                <telerik:SumFunction SourceField="TotalUnits" ResultFormatString="{}Total units: {0:f}" />
                            </local:RadNumericUpDownColumn.AggregateFunctions>
                        </local:RadNumericUpDownColumn>
                    </r:RadGridView.Columns>



    Hope this would help you in better understanding the Grid and Grouping functionality we have implemented.

    Now find out the previously attached Screednshot. In that as we change any cell value, Grid Footer is updated but not the Group Row Footer.


    Thanks,

    Sumit


  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 Oct 2010 Link to this post

    Hi Sumit,

    The fact that the Aggregate Results are not updated in the Group Footer is a know issue and we are working on its fix. You may follow up its progress in our Public Issue Tracking System by its ID - 2970 or directly through this link.
     

    Greetings,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Fredrik
    Fredrik avatar
    1 posts
    Member since:
    Aug 2010

    Posted 25 Oct 2011 Link to this post

    HI,

    Is this issue solved?
    I cant find it in your issue tracker.

    Regards
    /Fredrik
  9. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 25 Oct 2011 Link to this post

    Hello Fredrik,

    The issue has been resolved. Please, try our latest internal build - version 2011.2.1024.
    Here is the PITS issue link.
     
    Best wishes,
    Yordanka
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top