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

[Solved] aggregate functions updating

3 Answers 126 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
david ocasio
Top achievements
Rank 1
david ocasio asked on 06 Nov 2009, 03:29 PM

a simple question

do the aggregate functions recalculate if there is a change to the column it is adding up

in other words
if i edit a columns value will it recaclulate

thanks
dco

3 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 11 Nov 2009, 05:14 PM
Hi david,

Currently the grid will not recalculate the aggregate results when a value is changed. We plan to fix this in our next service pack release.

Meanwhile a simple one line workaround can be implemented. You can use the RowEditEnded event with combination of CalculateAggregates() method:
this.gridView.RowEditEnded += (s, args) => this.gridView.CalculateAggregates();

Best wishes,
Stefan Dobrev
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.
0
Greg Phaling
Top achievements
Rank 1
answered on 12 Nov 2009, 05:15 PM
Hi Stefan,

Unfortunately this workaround does not appear to work.  I debugged the CalculateAggregates call and it seems that the aggregates are being recalculated correctly, but the subsequent call to RebindAggregateResultsList does nothing.  Perhaps because the code is commented out:

        private void RebindAggregateResultsList() 
        { 
            if (!ShowColumnFooters) return
 
            //if (this.ItemsControl == null) return; 
 
            //this.ItemsControl.ApplyTemplate(); 
 
            //GridViewFooterRow row = this.FooterRow; 
            //if (row != null) 
            //{ 
            //    row.ApplyTemplate(); 
            //    row.Cells.ToList().ForEach(c => c.ApplyTemplate()); 
            //    row.ChildrenOfType<AggregateResultsList>().ToList().ForEach(l => l.Bind()); 
            //} 
        } 
 

Uncommenting the code does not help as ItemsControl is undefined.  Please advise.

Greg

0
Stefan Dobrev
Telerik team
answered on 13 Nov 2009, 07:45 AM
Hi Greg,

This is already have been fixed and will be available in the next internal release that we are going to publish.

Best wishes,
Stefan Dobrev
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.
Tags
GridView
Asked by
david ocasio
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Greg Phaling
Top achievements
Rank 1
Share this question
or