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

Grid Cells Resize When Scrolling Reaches Last Column

3 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rjcup3
Top achievements
Rank 1
rjcup3 asked on 15 Nov 2012, 09:30 PM
I have a RadGrid that I am using in a web application for a client. The issue I am facing presently is that when the horizontal scrolling reaches the last column on the right of the grid, all of the cells in the grid resize (growing in both width and height). I have some screen shots hosted here:

1) Far Left
2) Second to Last Column
3) Last Column (every cell resizes)

I have specified the following settings when I bind my data source in the code behind:
 AutoGenerateColumns = true;
 ClientSettings.Scrolling.AllowScroll = true;
 ClientSettings.Scrolling.SaveScrollPosition = true;
 ClientSettings.Scrolling.FrozenColumnsCount = 5;
 ClientSettings.Scrolling.UseStaticHeaders = true;
 Width = Unit.Pixel(1200);
 MasterTableView.TableLayout = GridTableLayout.Fixed;

And in my ColumnCreated event I have the following code:
if (e.Column.UniqueName == "ID")
    e.Column.Display = false;
 
e.Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
e.Column.HeaderStyle.Width = Unit.Pixel(40);
 
if (e.Column.UniqueName == "Process")
    e.Column.HeaderStyle.Width = Unit.Pixel(100);
if (e.Column.UniqueName == "Act/Dept")
    e.Column.HeaderStyle.Width = Unit.Pixel(300);
if (e.Column.UniqueName == "Visit")
    e.Column.HeaderStyle.Width = Unit.Pixel(80);

Also, I have overridden the scroll bar's CSS such that:
 margin-right: 0px !important;

However this behavior is observed with and without this.

How can I resolve the cell resizing behavior that I am seeing?

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 Nov 2012, 01:54 PM
Hello,
 
When scrolling and static headers are enabled the control always needs to readjust its layout with some Javascript calculations during window resize, so some jumping is expected. This is so, because when the scroll is moved to the end the last column should be visible in its original size, however if its width is larger than the previous the grid layout should readjust column widths, so that all of the columns to be visible. You can avoid this if all columns have the same width and the width of the grid is calculated in order the visible column to be in their full size. Please excuse us for the inconvenience caused.

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
rjcup3
Top achievements
Rank 1
answered on 19 Nov 2012, 04:53 PM
Hello Pavlina,

I have tried to expand the width of the grid as you suggested at run time, however I am still seeing this behavior. What specifically do I need to resize, as I am a little confused by the wording of your answer.

The frozen columns have variable widths, but all of the scrolling columns have the same width (40px) until they are resized when the scrollbar reaches the last column (then they grow to 46px). This is especially problematic because the column headers do not resize to match this behavior, leading to the headers being misaligned with the content of the grid.

I have already included the Javascript to resize the height of the grid on load if the content area is less than the defined size of the grid. The Javascript was provided at http://www.telerik.com/help/aspnet-ajax/grid-resize-grid-with-scrolling-when-less-data.html. What do I need to include to resize the width of the grid as you suggest?
0
Pavlina
Telerik team
answered on 21 Nov 2012, 03:59 PM
Hello,

If you can isolate the described problem in a sample runnable project and send it to us via support ticket will help us to provide a proper solution. Thus we will be able to modify it in order to prevent resizing of grid cells while scrolling.

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
rjcup3
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
rjcup3
Top achievements
Rank 1
Share this question
or