Scrolling + FrozenColumnCount + Grid Width

9 posts, 0 answers
  1. Terrance
    Terrance avatar
    7 posts
    Member since:
    Nov 2008

    Posted 13 Apr 2009 Link to this post

    Looking at the example provided by telerik.
    http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/frozencolumns/defaultvb.aspx

    Our RadGrid columns change based on some search criteria.

    The first four columns we can freeze. 
    The next N columns we want to scroll.  The problem is the RadGrid may have a bunch of space to the right of the grid as it scrolls.

    Telerik has examples on: "Resizing grid with scrolling when data is less than scroll height"
    http://www.telerik.com/help/aspnet-ajax/grdresizegridwithscrollingwhenlessdata.html

    and "Changing grid ScrollHeight at runtime to fill its container height"
    http://www.telerik.com/help/aspnet-ajax/grdchangescrollheightatruntime.html

    but what about "when the WIDTH of the grid changes based on columns being returned".  In one scenario, we may have 5 columns returned where the first 4 columns are frozen.  If the Grid is 800px wide.  The 5 column is now (maybe) 400px wide.
    Or we may bring back 30 columns.  When we scroll to the right, the columns end, but the scrollbar continues with dead space to the right.

    Any ideas?
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 16 Apr 2009 Link to this post

    Hello Terrance,

    Thank you for the detailed explanation. Can you please check whether setting fixed widths for your grid columns (through their HeaderStyle -> Width property) or TableLayout = Fixed for the master table makes a difference? Note that the default table layout for the grid with scrolling enabled is auto and this may cause the unwanted effect when you enable the frozen columns functionality.

    Best regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Frankie
    Frankie avatar
    9 posts
    Member since:
    Jan 2008

    Posted 18 May 2009 Link to this post

    How about if the different column need the different width, it cannot be auto fix it (each column have the same column width)?
    And now my problem is we need to show more than 30 columns which as the results not all the columns are shown.

  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 18 May 2009 Link to this post

    Hi Frankie,

    You can control the individual column widths through the HeaderStyle -> Width property of each column. How to set this property for declarative/auto-generated columns from the code-behind you can see from the last paragraph of this documentation topic.

    Kind regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Damian
    Damian avatar
    16 posts
    Member since:
    May 2004

    Posted 05 Oct 2009 Link to this post

    Hi, if you set the header styles to specific widths the effect is that as the columns scroll left or right they adopt the column width that was originally at that position, This means that a column that is very wide might be scrolled into a potion where the column width is very narrow. This can result in the grid looking very messy. Is there a way to ensure the columns retain their column widths regardless of where they scroll to?

    Thanks,

    Damian.
  7. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 05 Oct 2009 Link to this post

    Hello Damian,

    If you specify fixed widths for the grid columns in pixels, they should be honored regardless of the scroll position. You can verify that on the examples referenced previously in this forum thread. Let me know if I am missing something.

    Greetings,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Damian
    Damian avatar
    16 posts
    Member since:
    May 2004

    Posted 05 Oct 2009 Link to this post

    Thanks for replying but the example I have seen all use the same column widths so do not experience the problem. I have defined my columns as you see below.

                        <telerik:GridEditCommandColumn> 
                            <HeaderStyle Width="60px" /> 
                        </telerik:GridEditCommandColumn> 
                        <telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title" 
                            UniqueName="Title">  
                            <HeaderStyle Width="30px" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" 
                            UniqueName="FirstName">  
                            <HeaderStyle Width="80px" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName" 
                            UniqueName="LastName">  
                            <HeaderStyle Width="80px" /> 
                        </telerik:GridBoundColumn> 

    In the example above of the FrozenColumnsCount="1" as you scroll the left most column (that is not frozen) will be squeezed into a column 30px wide.

    Hope that makes more sense.

    Damian.
  9. Ryan
    Ryan avatar
    9 posts
    Member since:
    Sep 2007

    Posted 05 Oct 2009 Link to this post

    I'm running into this exact same problem.  I started searching, and found this thread that's active just in the past few hours!  Hopefully a solution will be provided soon, as the frozen columns feature seems very broken otherwise.
  10. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 06 Oct 2009 Link to this post

    Hello Ryan and Damian,

    Unfortunately there are specifics with the frozen columns feature of RadGrid for ASP.NET AJAX in some scenarios which may cause the side effect you are describing in this thread. They are due to the particular rendering of the grid in this mode and the combination of separate divs, scrolling synchronization and column width settings. We will do our best to improve the frozen columns behavior in those cases as much as possible for the next versions of the product.

    At this point my suggestion would be to adjust the widths of the columns to bypass the unwanted discrepancy. I truly hope this is possible for your grid configurations.
     
    Kind regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017