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

Add SelfReferencing best fit column not working

2 Answers 72 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
Eric Moreau asked on 26 Aug 2020, 12:28 PM

Hi

I have a self referencing grid (using something like .Relations.AddSelfReference(.MasterTemplate, "ID", "IDParent")) and using .BestFitColumns() to automatically adjust columns width. 

The ID column that contains (the column showing the hierarchy) is not adjusting for all the levels. 

I needed to set the MinWidth property of the column to try to set a better width.

Is there something you can do?

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Aug 2020, 07:10 AM
Hello, Eric,

Following the provided information, I was unable to reproduce the issue you are facing. Please refer to the attached gif file illustrating the behavior on my end with the latest version. I have attached my sample project for your reference.

The BestFitColumns(BestFitColumnMode mode) method allows you to specify the BestFitColumnMode which controls which cells will participate in the calculations for the required space to fit the text. You can find below all available modes:
- BestFitColumnMode.None - The column's width does not automatically adjust.
- BestFitColumnMode.AllCells - The column's width adjusts to fit the contents of all cells in the control.
- BestFitColumnMode.DisplayedDataCells - The column's width adjusts to fit the contents of the displayed data cells.
- BestFitColumnMode.HeaderCells - The column's width adjusts to fit the contents of the header cell.
- BestFitColumnMode.FilterCells - The column's width adjusts to fit the contents of the filter cell.
- BestFitColumnMode.SummaryRowCells - The column's width adjusts to fit the contents of the summary row cell.
- BestFitColumnMode.DisplayedCells - The column's width adjusts to fit the contents of the displayed cells.

In case you are still experiencing any further difficulties, please give us some more details how to replicate the issue locally so I can investigate the precise case. Thank you in advance. 

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

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 27 Aug 2020, 12:39 PM

You nailed it! I need to specify AllCells.

I was calling mygridname.BestFitColumns() but without any arguments.It was working fine for regular columns but not the self-reference one!

Thanks.

Tags
GridView
Asked by
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or