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

RadGrid FrozenColumns Width Issue

8 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 23 Jul 2013, 01:41 PM
I have a RadGrid with 24 Template Columns. These columns are generated during runtime based on a dateset. I also set the width of the columns to a set width depending on the size of the data in the columns (although most of the columns are the same size as each other)
 (e.g. col.HeaderStyle.Width = Unit.Pixel(80)). In client settings I have horizontal scrolling enabled (as the grid is a set width but the data is extended) and the FrozenColumnsCount="2".
This all works fine- The correct data displayed, correct widths and when I scroll right the 1st two columns remain where they are whilst the others scroll allowing me to nicely compare.

This Issue is when I scroll to the very far right (the very last column). When the scrollbar reaches the very end all columns including the first two columns that are frozen have their width increased by a noticeable amount. This looks a bit weird and I was hoping to be ale to change some setting so that it doesn't change the width. I've tried many settings such as to set TableLayout in MasterTableView to fixed and set AllowColumnResize to false but this had no effect on the issue.

Do you know of a solution?
Thank You

Code Below:
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" OnInit="RadGrid1_Init" OnPreRender="RadGrid1_PreRender" OnItemDataBound="RadGrid1_ItemDataBound" CssClass="cssGrid" Skin="Vista" ClientSettings-AllowRowHide="true" 
        ClientSettings-AllowColumnHide="true" ClientSettings-AllowColumnsReorder="true" ClientSettings-AllowKeyboardNavigation="true" 
        AllowFilteringByColumn="false" ClientSettings-Resizing-ClipCellContentOnResize="true" HeaderStyle-Wrap="false" HeaderStyle-CssClass="cssColumns" HeaderStyle-HorizontalAlign="Center">
            <MasterTableView CommandItemDisplay="Bottom" AutoGenerateColumns="false">
<Columns>
...
</Columns>
</MasterTableView>
           <ClientSettings>
                <Resizing AllowColumnResize="true" EnableRealTimeResize="true" ShowRowIndicatorColumn="false" AllowResizeToFit="true" AllowRowResize="true" />
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="1" />
                <Selecting AllowRowSelect="true" />
            </ClientSettings>

8 Answers, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 25 Jul 2013, 08:03 AM
Can anyone answer this?

Edit:
Starting to believe this is a bug as this issue even happens with your own grid:
See Demo http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/frozencolumns/defaultcs.aspx
On scrolling to the far right on horizontal bar the columns width changes (expands) which looks odd.
0
Venelin
Telerik team
answered on 26 Jul 2013, 08:54 AM
Hi Tim,

Currently this is the default behavior and we are aware of it. Please refer to this forum topic for more information: http://www.telerik.com/community/forums/aspnet-ajax/grid/frozen-column-scrolling-issues.aspx.

Please also note that when you have static headers the table layout is always fixed and you don't need to set it explicitly.

Regards,
Venelin
Telerik
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 the blog feed now.
0
Tim
Top achievements
Rank 1
answered on 29 Jul 2013, 08:03 AM
Thanks Venelin, as a workaround I've used two radgrids side by side (one for the columns I need frozen and one for the columns I want to scroll).
0
Venelin
Telerik team
answered on 31 Jul 2013, 02:28 PM
Hi Tim,

Let me explain why this behavior is logical and expected. In the mentioned demo we have a RadGrid with width of 750px and 4 columns with equal widths of 200px (total 800px). The first two columns are frozen so they can't move anywhere. When you scroll to further right the space between the second frozen column right border and the right border of the grid is 750px - 2x200px = 350px. Since this space of 350px is not enough to display two columns at once and it is too big for one column the only available option is to display the columns with bigger width in order to fit the whole space.

Regards,
Venelin
Telerik
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 the blog feed now.
0
Tim
Top achievements
Rank 1
answered on 01 Aug 2013, 08:24 AM
Hi Venelin, 

Thanks for your reply but I disagree with you. This shouldn't be the expected behaviour - it just looks silly. The frozen columns width doesn't change for the rest of the scrolling. The natural behaviour (in my opinion) (or at the very least an option should be provided to stop the widths of the frozen columns from changing). I can think of a few solutions of doing this:
Stop from scrolling to the extreme right so this behaviour doesn't occur. (e.g. when you can see the fax and manager columns stop scrolling there) (this would be my first choice)
Don't change the frozen columns width just replace the gap with empty space.
On reaching the extreme right keep the frozen columns width and use space to display as much as possible of the last column(s) (you may end up cropping a part of a column from the view).
examples taken from your demo.
0
Venelin
Telerik team
answered on 06 Aug 2013, 08:40 AM
Hi Tim,

Your opinion, as every other client's opinion, is very important to us and we take it in account for future implementations of our controls. However, the current implementation stands on the mentioned logic in my previous post.

Regards,
Venelin
Telerik
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 the blog feed now.
0
amitesh
Top achievements
Rank 1
answered on 05 Jan 2016, 04:43 AM

A very simple fix to this problem when you have scrolling columns with few frozen columns is below:

Just make sure that you set the GridView width equal to the width of number of visible columns at any point of time. Can be understood with the example as:

Let us suppose we have 20 columns in the grid view. Out of these two first two are frozen & after frozen columns we have to display 6 columns and rest depending on scroll. So to notice here is that at any point of time we have 8 columns being displayed (2 frozen + 6 scrolling). So set the header style width of all these columns to let us say 100. So you must set the width of your GridView to 800 and like wise.

0
Venelin
Telerik team
answered on 05 Jan 2016, 09:22 AM
Hi amitesh,

Thanks for sharing your thoughts. This will prove helpful for developers having the same scenario.

Regards,
Venelin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Tim
Top achievements
Rank 1
Answers by
Tim
Top achievements
Rank 1
Venelin
Telerik team
amitesh
Top achievements
Rank 1
Share this question
or