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

Radgrid static header issue

11 Answers 475 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rashmi
Top achievements
Rank 1
Rashmi asked on 10 Jan 2012, 03:45 PM
Hi,
 I have a radgrid with static headers, scrolling enabled and resizable columns. When grid is loaded initially, everything is fine. But when I resize any of column, a gap(white space) comes between mastertableview and scrollbar. I have tried many solutions given on telerik forum, but none of them helped.

Regards,
Mahesh
<telerik:RadGrid ID="Grid" runat="server" Width="100%"
         AutoGenerateColumns="false">
    <HeaderStyle Font-Bold="False" Font-Size="Small" />
    <ClientSettings EnableAlternatingItems="false">
        <Resizing AllowColumnResize="true" ClipCellContentOnResize="true" ResizeGridOnColumnResize="false"
        ShowRowIndicatorColumn="false" EnableRealTimeResize="false" AllowResizeToFit="true" />
        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" />
    </ClientSettings>
    <ItemStyle Wrap="false"/>
    <AlternatingItemStyle Wrap="false" />
    <HeaderStyle Wrap="false" />
    <MasterTableView TableLayout="Fixed" Width="100%">
    </MasterTableView>
</telerik:RadGrid>

11 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Jan 2012, 04:06 PM
Hello,

Please note that when using resizing with scrolling and static headers only the GridTableView is resized - RadGrid's width remains fixed. Therefore the behavior you have observed (blank space after the last column) is expected. The grid does not support automatic column width recalculations when the sum of the widths of all its columns is less than the sum of the grid width. Please turn off static headers or leave the control as is, with the ability to add a horizontal scrollbar or empty space on the right.

All the best,
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
Rashmi
Top achievements
Rank 1
answered on 10 Jan 2012, 04:12 PM
Hi Pavlina,
 In code behind I am creating columns. Some of them have width in percentage and others have width in pixel. Last column is assigned any width. So I expect that when any column is resized, the columns with percentage width OR last column should adjust their width to fit radgrid's width. Actually we have requirement which requires scrolling with static headers and column resizing. Any thoughts on this?

Regards,
Mahesh
0
Pavlina
Telerik team
answered on 10 Jan 2012, 05:27 PM
Hello,

I understand your point of view, however due to the current implementation of the RadGrid control this functionality could not be implemented. Please excuse us for the inconvenience caused.

All the best,
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
Rashmi
Top achievements
Rank 1
answered on 21 Jan 2012, 06:43 AM
Hi Pavlina,
  As workaround I have added following code in OnColumnResized event so that white gap should be filled up.
    $('.rgClipCells').css('width', "100%");
            $('.rgRow').css('width', "100%");

In this case column resizes but to width not specified by user. Also ImageColumns that are set as IsResizable=false also get resized.
Is this right approach to implement it or is it overriding some internal properties? Also I want to set minimum and maximum width for columns? How to go about that?

Thanks,
Mahesh
0
Pavlina
Telerik team
answered on 26 Jan 2012, 01:38 PM
Hi Mahesh,

The observed behaviour after you tried to workaround this limitation is rather expected. The only option to fill the empty space which appear after you resize a column in grid is to change the width of the other columns too.

Additionally, to be able to set minimum width of the grid column you can subscribe to the ColumnResizing client event and cancel it, if the new column width is too small.
http://www.telerik.com/help/aspnet-ajax/grid-oncolumnresizing.html
<script type="text/javascript">
       function ColumnResizing(sender, args) {
           var newWidth = args.get_gridColumn()._columnResizer._currentWidth;
           if (newWidth < 200) {
               args.set_cancel(true);
           }
       }
   </script>

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
Rashmi
Top achievements
Rank 1
answered on 13 Feb 2012, 09:29 AM
Hi Pavlina,
 How to change width of other columns if any of column is resized?
Thanks,
Mahesh
0
Pavlina
Telerik team
answered on 14 Feb 2012, 11:48 AM
Hi Mahesh,

You could handle RadGrid's client-side OnColumnResized event and use the offsetWidth attribute to change the width of the desired columns.

Kind regards,
Pavlina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Rashmi
Top achievements
Rank 1
answered on 14 Feb 2012, 12:14 PM
Hi Pavlina,
  In 'columnresized' event I tried setting this attribute 'args._gridColumn._element.offsetWidth'. But it gives error saying 'Object doesn't support this property or method...'. How can I assign width to all columns in 'columnresized' based on some constraints? Which property do I need to set? Plz reply soon. I am stuck with this since many days.
Thanks,
Mahesh
0
Pavlina
Telerik team
answered on 17 Feb 2012, 12:25 PM

Hi Mahesh,

Consider opening a regular support ticket where you can send us a small runnable project along with the portion of your data that we can test and debug locally. Thus, we will be able to better understand your scenario and provide a proper workaround for this issue.

Kind regards,
Pavlina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Rashmi
Top achievements
Rank 1
answered on 06 Mar 2012, 08:22 AM
Hi Pavlina,
 http://www.telerik.com/support/pits.aspx#/details/Issue=9399 

Is this the same issue? I didn't find any description there.
Regards,
Mahesh
0
Pavlina
Telerik team
answered on 06 Mar 2012, 01:38 PM
Hello,

The pointed issue is about MasterTableView width is not 100% when there are no records in the assigned DataSource and UseStaticHeaders property is set to true.

All the best,
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
Rashmi
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Rashmi
Top achievements
Rank 1
Share this question
or