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

Issues implementing a conditional GridGroupContentCellElement

2 Answers 66 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 08 Dec 2017, 08:22 PM

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.

Thanks

 

2 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 08 Dec 2017, 09:33 PM

Hello,

  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.

Thanks

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Dec 2017, 09:03 AM
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: https://docs.telerik.com/devtools/winforms/gridview/cells/creating-custom-cells

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
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.
Tags
GridView
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or