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

[Solved] Specifying grid height.

2 Answers 511 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.
Richard
Top achievements
Rank 1
Richard asked on 08 Sep 2010, 03:57 PM

Using version 2010.2.825 of the MVC controls I am trying to work out how to specify the height of the grid in pixels. I thought I would use the "TableHtmlAttributes" property as shown below, but this cause the header columns to become 500px rather than the whole height of the grid.

MVC Version 3 Preview 1
All running on a Windows Vista Machine with VS2010
Browser is IE 8.0
Telerik MVC Version 2010.2.825

Any help appreciated.

Richard

@(Html.Telerik().Grid(Model)

.Name("Grid")

.TableHtmlAttributes(new { style = "height:500px" })

.DataKeys(dataKeys => dataKeys.Add(c => c.UserId))

.Columns(columns =>

{

columns.Bound(c => c.LoginId).Width(200).Title("Login ID");

columns.Bound(c => c.Fullname).Width(300).Title("Full Name");

columns.Bound(c => c.GroupName).Width(120).Title("Group Name");

columns.Bound(c => c.LastLoggedIn).Format("{0:d}").Width(120).Title("Last In Date");

columns.Bound(c => c.HasMapping).Width(50).Title("Map?");

columns.Bound(c => c.HasMapSpecial).Width(50).Title("SMap?");

columns.Bound(c => c.HasReportDesigner).Width(50).Title("Rep?");

columns.Bound(c => c.HasMobile).Width(50).Title("Mob?");

})

.Scrollable(scrolling => scrolling.Enabled(true))

.Sortable(sorting => sorting.Enabled(true))

.Pageable(paging =>

{

paging.Enabled(true) ;

paging.PageSize(10) ;

})

.Selectable()

.Footer(true))

2 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 08 Sep 2010, 06:41 PM
Solved my own problem using jquery

<script>

$('#Grid .t-grid-content').height('500px');

</script>

0
Hristo Germanov
Telerik team
answered on 09 Sep 2010, 09:11 AM
Hi Richard ,

I am glad to hear that you have solved your problem.

Other solution of this issue is to use Scrollable() method like so:

.Scrollable(c => c.Height("500px"))

Thus "500px" will be applied exactly to the t-grid-content table.

Kind regards,
Hristo Germanov
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
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Hristo Germanov
Telerik team
Share this question
or