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

Width is ignored on columns

1 Answer 44 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.
jfkrueger
Top achievements
Rank 1
jfkrueger asked on 24 May 2012, 03:26 PM
I can't get the grid to accept the column widths specified, the grid always takes up the width of the entire container it is in. How do I get the grid to respect the column widths specified?

@(Html.Telerik().Grid(Model)
    .Name( "Grid" )
    .Columns( columns =>
    {
        columns.Bound( student => student.PersonId ).Hidden(true);
        columns.Bound( student => student.LastName ).Width( 50 );
        columns.Bound( student => student.FirstMidName ).Width( 100 );
        columns.Bound( student => student.EnrollmentDate ).Format( "{0:d}" ).Width( 100 );
    })
    .DataBinding( dataBinding =>
    {
        dataBinding.Server().Select( "Index", "Student", new{ajax = true} );
        dataBinding.Ajax().Select( "AjaxIndex", "Student" ).Enabled( true );
    } )
    .PrefixUrlParameters( false )
    .Scrollable( scrolling => scrolling.Enabled( true ) )
    .Sortable( sorting => sorting.Enabled( true ) )
    .Pageable( paging => paging.Enabled( true ) )
    .Filterable( filtering => filtering.Enabled( true ) )
    .Groupable( grouping => grouping.Enabled( true ) )
    .Footer( true )
    .Selectable()
    .ClientEvents( events => events.OnRowSelect( "onRowSelected" ) )
    .TableHtmlAttributes( new
    {
        style = "table-layout:fixed;"
    } )
)

1 Answer, 1 is accepted

Sort by
0
jfkrueger
Top achievements
Rank 1
answered on 24 May 2012, 03:29 PM
Looks like I need to wrap it in a div with a specified width. Would be much better if the grid just accepted the values given rather than always taking up the width of the entire container it is in.
Tags
Grid
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
jfkrueger
Top achievements
Rank 1
Share this question
or