Not able to scroll horizontally to all columns in dynamically generated SfDataGrid

I have a dynamically generated SfDataGrid that has more than 20 columns but given my requirements (listed below) I'm not able to scroll horizontally to all the columns through the end.

I'm providing a zip file with an app that reproduces this problem. We can focus on Android.

My basic requirements:

  • Player column should auto-adjust to the longest player name (I'm creating a fake long long player name) and should not wrap. For this, I'm using a ICalculateTextWidth interface that I implement in Android and iOS. Player column should be align to left
  • "Tot" column and all columns from J1 to J21 should adjust to their content without occupying much space since I have too many columns. In code I'm manually setting this fixed column widths on MainPage.xaml.cs lines 85 (longest player name width) and line 122 to set Tot and J* column widths to 40
Here some observations:

  • if I DON'T set my SfDataGrid to ColumnSizer value (using default ColumnSizer.None) and I don't set any fixed col widths (line 85,122) I'm able to scroll to all columns but columns occupy much empty space. 
  • If I set ColumnSizer to Auto and not setting fixed col widths (line 85,122) I'm not able to horizontally scroll beyond column J13
Looks like it is difficult to meet my requirements of being able to scroll to all columns, not wrap text and not occupy much empty space for columns.

Any suggestions to meet my requirements?


Attachment: DataGridDemo_Standings_Repro_1c460797.zip


9 Replies

SV Suja Venkatesan Syncfusion Team May 9, 2022 02:05 PM UTC

Hi Adolfo,


We would like to let you know that the reported issue “Not able to scroll horizontally to all columns” occurs due to ScrollingMode with value Line. Currently, we are validating the reported issue on our end. We will update you with further details on or before May 11, 2022. We appreciate your patience and understanding.


Regards,

Suja



AD Adolfo May 9, 2022 06:31 PM UTC

Thank you!



SV Suja Venkatesan Syncfusion Team May 10, 2022 03:52 PM UTC

Hi Adolfo,


As we promised in our previous update, we will update you with further details on or before May 11, 2022. We appreciate your patience and understanding.


Regards,

Suja



SV Suja Venkatesan Syncfusion Team May 11, 2022 02:46 PM UTC

Hi Adolfo,


Regarding “Set ColumnSizer to Auto and not setting fixed col widths (line 85,122) I'm not able to horizontally scroll beyond column J13

 

 

As we mentioned in our previous update the reported issue occurs due to ColumnSizer as Auto and ScrollingMode with value Line. We have logged the reported issue as a bug We will fix the issue and include the fix in our upcoming Weekly Nuget release update which is planned to roll out on June 7, 2022. We appreciate your patience until then.

 

You can track the status of this report through the following feedback link,

https://www.syncfusion.com/feedback/34828/columns-gets-clipped-when-columnsizer-as-auto-and-scrollingmode-with-value-line

 

Note: The feedback link provided is private, you need to login to view this feedback.

 

Regarding requirement “Player column should be align to left

You can achieve your requirement without setting Columnwidth by setting ColumnSizer as Auto for columns and load the templateColumn label inside the Grid layout as like below code snippet.

 

Code Snippet:

var dataGrid = new SfDataGrid()

            {

                AutoGenerateColumns = false,

                FrozenColumnsCount = 2,

                SortTapAction = SortTapAction.SingleTap,

                AllowSorting = true,

                ColumnSizer = ColumnSizer.Auto,

                AllowResizingColumn = false,

 

….

var templateColumn = new GridTemplateColumn()

                {

                    HeaderText = kvp.Key,

                    MappingName = $"Values[{kvp.Key}]",

                    AllowSorting = true,

                    ColumnSizer=ColumnSizer.Auto,

                    TextAlignment = TextAlignment.Center,

                    LineBreakMode = LineBreakMode.NoWrap,

                };

 

                //Setting TemplateColumnWidth to fixed value for Player column to max player length

                if (kvp.Key == "Player")

                {

                   // templateColumn.Width = longestNameWidth;

                }

 

                //I set column width to fixed values here

                ColumnCustomizations(templateColumn);

 

                var dataTemplate = new DataTemplate(() =>

                {

                    Grid gridsample = new Grid();

                    gridsample.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });

                    var label = new Label()

                    {

                        LineBreakMode = LineBreakMode.NoWrap,

                    };

                    label.SetBinding(Label.TextProperty, $"Values[{kvp.Key}]");

                   gridsample.Children.Add(label);

                    return gridsample;

                  

                });

                templateColumn.CellTemplate = dataTemplate;

                dataGrid.Columns.Add(templateColumn);

            }

 

We have attached a modified sample for your reference. Please have a look at this sample and let us know if you need any further assistance.

 


Regards,

Suja


Attachment: DataGrid_Scrolling_8e5a0f27.zip


AD Adolfo May 11, 2022 04:05 PM UTC

Thank you Suja. The solution works for me. I appreciate the quick help



SV Suja Venkatesan Syncfusion Team May 12, 2022 01:44 PM UTC

Hi Adolfo,


We are glad to know that the provided solution worked at your end. For the issue “Columns gets clipped when ColumnSizer as Auto and ScrollingMode with value Line” as we promised we will fix the issue and include the fix in our upcoming Weekly Nuget release update which is planned to roll out on June 7, 2022. We will let you know once the nuget has been released with fix.


Regards,

Suja



SV Suja Venkatesan Syncfusion Team June 8, 2022 04:44 PM UTC

Hi Adolfo,


We regret to inform you that, as we promised we are unable to include the fix. We need some more time to ensure all possible test cases with this fix. We will include the fix in our upcoming weekly nuget June 28,2022. We will let you know once it gets released with the fix. We appreciate your patience until then.


Regards,

Suja



SV Suja Venkatesan Syncfusion Team June 29, 2022 01:15 PM UTC

Hi Adolfo,


We have fixed the reported issue “Columns gets clipped when ColumnSizer as Auto and ScrollingMode with value Line” and included the issue fix in our latest Weekly NuGet release update version 20.1.0.61 which is available for download (https://www.nuget.org/).   


We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you require any further assistance.


Regards,

Suja



AD Adolfo June 29, 2022 01:35 PM UTC

Great news thanks @Suja!


Loader.
Up arrow icon