GridView Refresh Group Totals

4 posts, 0 answers
  1. Adam
    Adam avatar
    16 posts
    Member since:
    Oct 2010

    Posted 01 Nov 2010 Link to this post

    Hi Guys,

    I am working with a GridView that is using the Grouping  the ChildTable features.
    Each Group contains a child table of information as well as parent rows within the group itself.

    When rows in the Child Table are updated ideally I should be throwing a property change event that causes an update to the parent row. But my attempts tin acheiving this just couldn't get the parent row to see what was happening). Consequently i went tactical and am doing the update of the parent row data via the CellEditEnded function in the child table. This all works great.

    My last challenge is i need the currrent Group Totals FOR THE PARENT ROWS to be refreshed. The only way i have managed to do this is calling 'Rebind' which i think is a horrible solution! Is there a better way? I am using the standard SUM aggregate functions of the Telerik Grid.

     

     

    private void dgChildItemList_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)

    {

     

         List<ItemEntity> List = ((RadGridView)sender).Items.Cast<ItemEntity>().ToList();

         switch (e.Cell.DataColumn.DataMemberBinding.Path.Path.ToString())

         {

     

     

            case "myColumn":

           //this changes parent row data without the need for a rebind; using PropertyChanged event
           ((

     

    SummaryEntity)e.Cell.ParentRow.GridViewDataControl.ParentRow.DataContext).myColumn = GetTotal();

     

     

     

     

            break;

               }
               
               //needed cause the total don't reflect the update otherwise!
         dgRiskEntryList.Rebind();

    }

    Any help much appreciated!

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 03 Nov 2010 Link to this post

    Hi Adam,

    Basically, for the time being calling Rebind() is the way for recalculating the aggregates in the GroupHeader. We are in the process of researching a far more appropriate approach for achieving the same functionality and we will implement it as soon as we could provide the best possible solution.
    However, if you share more information about your exact scenario with details about the properties exposed, the type of aggregate functions and the expected behavior, I may be able to suggest another approach. 

    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. Stephen
    Stephen avatar
    11 posts
    Member since:
    Sep 2010

    Posted 03 Sep 2012 Link to this post

    Hi

    We are having a similar issue. Our grid has quite a number of rows and columns so we don't really want to call Rebind() to update the group aggregates if we don't need to.

    Has there been any further progress made on a better solution for this?

    Regards
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 06 Sep 2012 Link to this post

    Hello Stephen,

    Could you clarify what is your exact scenario ?  

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top