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

[Solved] Grid Header lines

2 Answers 212 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
M D
Top achievements
Rank 1
M D asked on 21 Dec 2009, 05:00 PM
Hi,
Having searched the forums my question is most like this one,
http://www.telerik.com/community/forums/aspnet-mvc/grid/fixed-header.aspx
that seems to have been abandoned by the poster.

I need to have multi-line headers because I have a Grid with a large number of columns, often with two-or-more word titles which cannot be usefully abbreviated.  This means that though the column values might be the width of a single digit, the column header makes the column excessively wide.  The cumulative result is a grid that disappears off the page in a very ugly style.

I have tried manually creating the title using the column Title method, with Environment.NewLine between words, which fails.
Also failing is the classic html trick of using the Width attribute to narrow the column and force text onto a new line.
I've also tried
HeaderHtmlAttributes(new {height = 80})


to make headers taller, but the space isn't used!

How can I force words in a column header onto new lines, to allow a 2 digit column to take a width of (say) 8 characters instead of 20?

Cheers
Matt


2 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 22 Dec 2009, 08:54 AM
Hello Matthew,

The following CSS should be enough to cause the columns to wrap:

div.t-grid .t-header, div.t-grid .t-last-header { white-space: normal; }
div.t-grid .t-header .t-link { height: auto; line-height: normal; }


Your other option is to enable scrolling and set the width of all columns, which should trigger a horizontal scroll.

Kind regards,
Alex
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.
0
M D
Top achievements
Rank 1
answered on 22 Dec 2009, 09:26 AM
Thanks.  That's excellent.

Tags
Grid
Asked by
M D
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
M D
Top achievements
Rank 1
Share this question
or