Issues implementing a conditional GridGroupContentCellElement

3 posts, 0 answers
  1. Mike
    Mike avatar
    5 posts
    Member since:
    Jun 2016

    Posted 08 Dec 2017 Link to this post

    Hello Telerik,

      I have a gridview where I would like to implement two levels of grouping.  The first level is the same, but the second level is conditional.  When the condition is true, I would like to use the CustomGridGroupContentCellElement (as your sample), where is false, I would like to use a standard GridGroupContentCellElement.

    I was able to get the initial display to work, but I am having issues with virtualization when the cell is being re-displayed during a collapse/expand and scrolling.

    What I am doing now:

    In then radgridview.CreateCell event handler;

    if (e.CellType == typeof(GridGroupContentCellElement) && e.Row.RowInfo.Group.Level == 1)
                   if (e.Row.RowInfo.ChildRows[0].DataBoundItem != null)
                       var myobjectInfo = e.Row.RowInfo.ChildRows[0].DataBoundItem as MyObjectClass;
                       if (myobjectInfo != null && myobjectInfo.TestCondition == true)
                           e.CellType = typeof(CustomGridGroupContentCellElement);


    When initially displaying the group, everything seems to work.  But when expanding/collapsing or scrolling, the incorrect group cell is displayed at times.

    I have looked at ViewCellFormatting and GroupSummaryEvaluate but don't know what I need to do in order to make sure the correct group cell is displayed.



  2. Mike
    Mike avatar
    5 posts
    Member since:
    Jun 2016

    Posted 08 Dec 2017 in reply to Mike Link to this post


      I was able to achieve the desired result by handling the way the display should look in the CustomGridGroupContentCellElement's SetContent().  Now I don't need to change to worry about changing the e.CellType after creating the CreateCell.


  3. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3201 posts

    Posted 12 Dec 2017 Link to this post

    Hello, Mike,

    Thank you for writing.  

    I am glad that the problem you were facing is now resolved. Have in mind that when you create custom cells it is important to override the IsCompatible method and thus to control for which rows/columns the custom cell is applicable. Additional information for creating custom cells is available in the following help article:

    I hope this information helps. Should you have further questions I would be glad to help.
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top