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

showcolumn size issue

3 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael Maluck
Top achievements
Rank 1
Michael Maluck asked on 19 Aug 2010, 09:23 AM
Hello all,

I use a custom control to enable the user to hide or show columns. The settings are persisted in a user's profile. When loading the profile server side I use the Display property of a column in C# to set it's initial visibility. This works very well.

The horizontol grid size is larger then the available screen size so RadGrid correclty shows a scrollbar.

When a user wants to show a column that was not visible before then RadGrid does not recalculate the new scroll width required to show all columns. Let me make an example.

V=visible column, X=invisible column

The users profile has those initial column visibility settings:
0  1  2   3  4  5  6  7  8
V  V  X  V  X  V  V  V  X

So column 2, 4, 8 are invisible on initial load.

The user now wants to make column 2 visible. Client side I call showColumn with no postback to achieve this. RadGrid correclty makes column 2 visible but now column 7 is out of scroll range for the user. If the user goes to a different page by using the pager then RadGrid recalculates the scroll width and everything works as expected. The API doc does not give any hints on calling a method to recalculate the scroll width.

Is this a bug? Is there a workround to make RadGrid recalculate the scroll width? Do you need any further information?

I try Rad Grid 2010.2.713.35

I use the following resizing settings in ClientSettings->Resizing:
AllowColumnResize: True
AllowRowResize: False
ClipCellContentOnResize: False
EnableRealTimeResize: True
ResizeGridOnColumnResize: True
ShowRowIndicatorColumn: True

Michael


3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 24 Aug 2010, 10:58 AM
Hello Michael,

RadGrid does not resize when you show / hide grid columns on the client. If you are using scrolling with static headers, you get the scroll width of the MasterTableView increase with each shown column. Columns that do not fit into the current visible table are are hidden.

You can use RadGrids' client-side OnColumnShown event to dynamically resize RadGrid when you show columns:

<ClientEvents OnColumnShown="gridColumnShown" />

function gridColumnShown(sender, args)
{
    var columnWidth = args.get_gridColumn().get_element().offsetWidth;
    var grid = sender.get_element();
    grid.style.width = grid.offsetWidth + columnWidth + "px";
}

The above code will add the width of the column that is just shown to the total width of the grid element.

Regards,
Veli
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Michael Maluck
Top achievements
Rank 1
answered on 23 Sep 2010, 05:54 PM
Hello Veli,

the more I work with RadGrid the more I get unhappy with RadGrid's sizing behavior. It's very hard to get things the way that are a good user experience in my opinion.

Your proposed solutions does not work. If columns are not visible initially as written in my previous post then args.get_gridColumn().get_element().offsetWidth returns 0. How to get the sizing to work client side?
In my case I use horizontal and vertical scrolling so sizing the grid itself makes the whole grid bigger and not the scrolled ared. How to do this correct?
When using both scroll directions the pager is also scrolled. Setting UseStaticHeaders of the ClientSettings->Scrolling node to true makes the pager static but horizontal scrolling does not work anymore. The grid just gets wider.

When resizing a column and let the user apply a filter value the custom column sizes are lost. Double clicking the resize area of a column header seems not to support autosizing of the column in relation to its content.

When indenting a detail table as proposed in another thread by using a css class, the detail table is exceeding the parent tables size and is truncated instead of being smaller.

So many flags, so many JavaScripts in this forum and it is still hard to get it good. :/

Regards,
Michael
0
Veli
Telerik team
answered on 28 Sep 2010, 09:23 AM
Hello Michael,

You are referring to several unrelated issues with RadGrid's scroll and column behavior. These need to be addressed separately. You can consider opening a regular support ticket where you can send us some test project demonstrating your particular scenario. We can use the test project to better understand your requirements and give advise based on your needs. When opening a support ticket, please, mention this forum thread as a reference.


Veli
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Michael Maluck
Top achievements
Rank 1
Answers by
Veli
Telerik team
Michael Maluck
Top achievements
Rank 1
Share this question
or