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

Grid columns losing their width when removing column

6 Answers 846 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 13 Aug 2014, 09:04 AM
Hi, when you remove a column from the column menu, the remaing cols lose their width. That happens when you explicitly define column width for more than 1 column. You can see an example in http://dojo.telerik.com/AGaQ, taken from http://demos.telerik.com/kendo-ui/grid/column-menu, the only difference is that I set the column witdh for everycolumn and not only the first one.
Thanks.

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Aug 2014, 12:42 PM
Hello Juan Jose,

The observed behavior is caused by invalid column width configuration - all column widths are too small, so they are initially ignored by the browser. When a column is hidden and all other visible columns have widths, the Grid applies a width style to the <table> (which was 100% wide until that moment), so that the widths of the remaining columns do not change. That is the time when the small column widths are actually applied.

Please refer to our documentation fur further details and modify the column widths to implement a valid scenario:

http://docs.telerik.com/kendo-ui/getting-started/web/grid/walkthrough#column-widths

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fernando
Top achievements
Rank 1
answered on 20 Aug 2014, 08:25 AM
Hi, first of all thanks for the answer, i tried with percents and it works but not properly. If i resize at least two columns, when i'm resizing the second one, the first column resized changes his size on his own. 
Then i tried with all the columns with specified width in pixels but one and it works properly.

There is only one more issue, when i resize columns and the total of all the widths in pixels is greater than the original size, i get overflow by the right and a scrollbar shows up. I wish to 'lock' the size of the grid and when i enlarge a column, the nearby column shrinks, as if the first column take the place of the second one.

Is there any way to do that?

Thanks.
0
Dimo
Telerik team
answered on 20 Aug 2014, 11:10 AM
Hello Juan Jose,

>> "I wish to 'lock' the size of the grid and when i enlarge a column, the nearby column shrinks, as if the first column take the place of the second one."

This column resizing behavior can be achieved only if Grid scrolling is disabled.

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fernando
Top achievements
Rank 1
answered on 20 Aug 2014, 11:51 AM
Hi, if i disable the scrolling of the grid, it works as i want, but also i can't specify the height of the grid. Can i disable only horizontal scrolling while the vertical scrolling is enabled?
Thanks.
0
Dimo
Telerik team
answered on 20 Aug 2014, 12:33 PM
Hi Juan Jose,

As I tried to explain, the desired column resizing behavior and Grid scrolling are mutually exclusive features. It is not possible to disable horizontal scrolling during column resize, while vertical is enabled.

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fernando
Top achievements
Rank 1
answered on 20 Aug 2014, 12:52 PM
Hi, i understand, thanks for the answer.
Tags
Grid
Asked by
Fernando
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Fernando
Top achievements
Rank 1
Share this question
or