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

Remove summary rows in grouped mode

1 Answer 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 26 Aug 2015, 02:27 PM

I can't remove summary rows in grouped mode.

---------------------------
# Context:
- We have a grid ​with a group filter
- User add "​Count" to summary row top
- Summary row is added, with the ​Count
- User remove the ​"Count" from the summary row top

---------------------------
# Behavior:
- ​The summary rows ​themselves ​still displayed empty (the "Count" element have just been removed);
- There are no problems when there is no grouping, the summary rows are correctly removed;
- Adding a group (manually or programmatically) resolves the problems, maybe forcing the grid to refresh;

---------------------------
# Actual ​Code:
private void RemoveSummaryRowTop(string strFunction, string headerText)
{
    //Here we remove item from the summary
    _grid.MasterTemplate.SummaryRowsTop.ForEach(summaryRow => summaryRow
        .Where(row => row.Aggregate.ToString() == strFunction && row.Name == headerText).ToList()
        .ForEach(x => summaryRow.Remove(x)));

    //Here we remove empty summary rows
    _grid.MasterTemplate.SummaryRowsTop.Where(x => x.Count == 0).ToList()
        .ForEach(x => _grid.MasterTemplate.SummaryRowsTop.Remove(x));
}

---------------------------
# Notes:
- Everything seems correct while debugging ... item is correctly found and removed from summary row, then empty summary row is found and removed correctly from SummaryRowsTop. As a result, there is nothing left (count = 0) in _grid.MasterTemplate.SummaryRowsTop

- We observed also that when scrolling to content a bit bottom there are no empty summary rows. We are ​supposing this is some content which has not been loaded before ​scrolling. Since summary rows are not displayed here, we clearly thing about a bug with telerik UI update.

- ​We're using version 2015.1.331.40
- I've tested same code with latest version 2015.2.728

---------------------------
# Tried:
- _grid.Refresh();
- _grid.MasterTemplate.Refresh();
- _grid.Update();
- _grid.ResetBindings();
- _grid.Invalidate();
- _grid.MasterTemplate.SummaryRowsTop.Clear();
- _grid.SummaryRowsTop.Clear();
- _grid.TableElement.Update(GridUINotifyAction.Reset);
- _grid.TableElement.Update(GridUINotifyAction.ResetView);

---------------------------
# Only way it ​works is adding and removing a group (seems to force refresh of the view):
private void RemoveSummaryRowTop(string strFunction, string headerText)
{
    //Here we remove item from the summary
    _grid.MasterTemplate.SummaryRowsTop.ForEach(summaryRow => summaryRow
        .Where(row => row.Aggregate.ToString() == strFunction && row.Name == headerText).ToList()
        .ForEach(x => summaryRow.Remove(x)));

    //Here we remove empty summary rows
    _grid.MasterTemplate.SummaryRowsTop.Where(x => x.Count == 0).ToList()
        .ForEach(x => _grid.MasterTemplate.SummaryRowsTop.Remove(x));

    //Here we add then remove a group to force grid refresh
    GroupDescriptor descriptor = new GroupDescriptor();
    descriptor.GroupNames.Add("DESC_SERVICE", ListSortDirection.Ascending);
    _grid.GroupDescriptors.Add(descriptor);
    _grid.GroupDescriptors.Remove(descriptor);
}

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 31 Aug 2015, 10:30 AM
Hello Richard,

Thank you for writing.

It appears that you have encountered a known issue within RadGridView, it is logged in our feedback portal. The bug has already been fixed in our development version of the source code and it will be publicly available with our next official release, scheduled for the beginning of October. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

Until the new version gets released you would need to implement the suggested workaround in the feedback item or use your approach adding and removing a fake group descriptor.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Richard
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or