This is a migrated thread and some comments may be shown as answers.

Group Footer Auto Aggregate on Cell Commit

8 Answers 134 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hrushikesh
Top achievements
Rank 1
Hrushikesh asked on 06 Sep 2010, 07:42 AM
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

8 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 07 Sep 2010, 09:19 AM
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
0
Hrushikesh
Top achievements
Rank 1
answered on 08 Sep 2010, 07:03 AM
Thank You, Code is working properly.
0
Sumit
Top achievements
Rank 1
answered on 01 Oct 2010, 10:49 AM
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
0
Maya
Telerik team
answered on 01 Oct 2010, 11:35 AM
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
0
Sumit
Top achievements
Rank 1
answered on 04 Oct 2010, 07:31 AM
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


0
Maya
Telerik team
answered on 04 Oct 2010, 08:31 AM
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
0
Fredrik
Top achievements
Rank 1
answered on 25 Oct 2011, 10:05 AM
HI,

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

Regards
/Fredrik
0
Yordanka
Telerik team
answered on 25 Oct 2011, 11:31 AM
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 >>

Tags
GridView
Asked by
Hrushikesh
Top achievements
Rank 1
Answers by
Maya
Telerik team
Hrushikesh
Top achievements
Rank 1
Sumit
Top achievements
Rank 1
Fredrik
Top achievements
Rank 1
Yordanka
Telerik team
Share this question
or