Summary row item for editable checkbox column

2 posts, 0 answers
  1. Zygmunt
    Zygmunt avatar
    6 posts
    Member since:
    Dec 2013

    Posted 14 Apr Link to this post

    Hi
    I have RadGridView with editable checkbox column. I created custom summary row item which code i presented below.

    public class CheckedRowsSummaryItem : GridViewSummaryItem
        {
            public CheckedRowsSummaryItem(string name, string formatString, GridAggregateFunction aggregate)
                : base(name, formatString, aggregate)
            { }
            public override object Evaluate(IHierarchicalRow row)
            {
                int count = 0;
                foreach (GridViewRowInfo childRow in row.ChildRows)
                {
                    try
                    {
                        if ((bool)childRow.Cells["chkBoxKol"].Value)
                        {
                            count++;
                        }
                    }
                    catch { }
                }
                return count;
            }
        }

     

    My problem is that when I change the chceckbox state my custom row summary for the column is not refreshed until I change current row or current cell. I tried to set IsCurrent properity on false or rise EndEdit() method for the grid in CellBeginEdit event but these solutions not worked. How could I programmatically make my summary refresh to avoid changing current column by the user?

     

    All the best

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3900 posts

    Posted 15 Apr Link to this post

    Hello, Zygmunt,

    According to the provided information, it is not clear how the GridViewCheckBoxColumn is setup on your end. However, I would recommend you to set its EditMode property to OnValueChange. Thus, you will ensure that as soon as you toggle the checkbox, the value will be committed to the associated DataBoundItem

    The EditMode property controls when the value of the editor will be submitted to the cell. By default, the current behavior is kept (OnValidate) and the value will be submitted only when the current cell changes or the grid looses focus. The new value (OnValueChange) will submit the value immediately after the editor value changes.

    Thus, your custom summary item is expected to calculate the value as expected.

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top