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

Expand/collapse button in RadGridView column group

4 Answers 95 Views
This is a migrated thread and some comments may be shown as answers.
sajin
Top achievements
Rank 1
sajin asked on 05 Dec 2018, 04:20 AM
Successful to get the button into header cell for expanding/collapsing the group columns except last one (this is sum of the reaming  columns since should not be collapsed) in each group.

This has been achieved by creating button in header cell through  radgrid CreateCell event.

But failed to achieve couple of below things,
Refer attached screenshot, expand/collapse button must be placed in title of the group, marked 1 in attached image. New position should be marked  in second image.
Button image must be changed, meaning while expanding, there is should be one image ,when collapsing there should be another image.
(Have tried this, but it is behaving strange, button image is getting changed in different position, seems it is redrawing )

Appreciate, if somebody could help us to accomplish this

4 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Dec 2018, 08:29 AM
Hello, Sajin,    

The following help article demonstrates a sample approach how t create custom cells in RadGridView: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells
Note that due to the UI virtualization in RadGridView, cell elements are created only for currently visible cells and are being reused during operations like scrolling, filtering, grouping and so on.  You can define that the custom cell is applicable only for specific columns by overriding the IsCompatible method of the cell element that you want to customize. This will prevent the cell from being unintentionally reused by other columns. The cell's SetContentCore method is suitable for synchronizing the data that is currently being displayed in the cell. This is the appropriate place for the image to be set considering the expanded state.

In order to inspect easily which element exactly you need to customize and insert the button, feel free to use RadControlSpyForm. For example, GridColumnGroupCellElement is used in the marked "1" number in the screenshot.

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
sajin
Top achievements
Rank 1
answered on 06 Dec 2018, 05:11 AM

Hi Team,

Thank you for coming back promptly.

have tried as you suggested, but no luck. Post changing GridHeaderCellElement to GridColumnGroupCellElement ,button has disappeared and also unable to achieve change of button image as well.  Sample application can be downloaded from the blow link .could you please Suggest on it?

 

https://drive.google.com/file/d/1EzKb6QPDj7ndWk4oL4E6CQpTWy2hXOfv/view?usp=sharing

0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Dec 2018, 07:19 AM
Hello, Sajin,    

I have reviewed the provided sample project and made thе following changes:

1. Subscribe to the CreateCell event before calling the DefineGroups method.
2. The custom ExpandCollapseHeaderCellElement inherits from GridColumnGroupCellElement
3. In the CreateChildElements method, add directly the RadButtonElement to the Children collection of the cell.
4. In the CreateCell event replace the default GridColumnGroupCellElement with the custom one.

Please refer to the attached modified sample project.



Off topic, I would kindly ask you to submit a support ticket from your Telerik account if you have any further questions. Thus, you will be allowed to attach sample projects. Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
sajin
Top achievements
Rank 1
answered on 12 Dec 2018, 04:04 AM
Sure, Thank you team. Will raise support ticket from our Telerik account
Asked by
sajin
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
sajin
Top achievements
Rank 1
Share this question
or