2012-12-29 9 views
5

Używam KendoUI Grid z biblioteką ASP MVC Complete Wrapper i mam problem z ustawieniem wysokości mojej siatki w kodzie. Próbowałem ustawić HTMLAttribute, ale wydaje się nie działać.Jak ustawić wysokość siatki KendoUI za pomocą narzędzia ASP MVC Complete Wrapper

@(Html.Kendo().Grid<SoftInn.Data.Country>() 
    .Name("grid-countries") 
    .DataSource(datasource => datasource.Ajax() 
           .Model(model => model.Id(record => record.Id)) 
           .Create(create => create.Action("Add", "Country")) 
           .Read(read => read.Action("GetAll", "Country")) 
           .Update(update => update.Action("Update", "Country")) 
           .Destroy(delete => delete.Action("Delete", "Country")) 
           .Events(events => 
              { 
               events.Sync("gridcountries_synchandler"); 
               events.Error("gridcountries_errorhandler"); 
              }) 
           .PageSize(10)         
    ) 
    .Columns(columns => 
       { 
        columns.Bound(r => r.Name); 
        columns.Bound(r => r.Currency); 
        columns.Bound(r => r.TimeZone); 
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(170); 
       }) 
    .ToolBar(toolbar => 
       { 
        toolbar.Create().Text("Add New Country");        
        toolbar.Custom().Text("Refresh").Url("#").HtmlAttributes(new { onclick = "window.refreshGrid($(this).parent().parent())", @class = "customRefreshButton" }); 

        toolbar.Custom().Text("More").Url("#").HtmlAttributes(new { onclick = "window.toggleDisplay($('#grid-countries > .k-grouping-header'))", @class = "customToggleButton float-right" });       
       } 
    ) 
    .Editable(editable => editable.Mode(GridEditMode.InLine)) 
    .Pageable(pageable => 
       { 
        pageable.Refresh(true); 
        pageable.PageSizes(true); 
       }) 
    .Resizable(resize => resize.Columns(true)) 
    .Reorderable(reorder => reorder.Columns(true)) 
    .Sortable() 
    .Scrollable() 
    .Filterable() 
    .Selectable() 
    .ColumnMenu() 
    .Groupable() 
    .HtmlAttributes(new { Height = "400px"}) 
) 
+1

Sprawdź więcej opcji: http://stackoverflow.com/questions/12955673/how-to-change-the-height-of-kendo-ui-grid – roadsunknown

Odpowiedz

12

Spróbuj wykonać następujące czynności:

.HtmlAttributes(new { style = "height:400px" }) 

bieżące ustawienie nie będzie działać, ponieważ Height nie jest ważny atrybut HTML dla elementu DIV których Kendo Siatka jest trójwymiarowa.

2

Wiem, że pytanie jest bardzo stare, ale może pomóc innym.

.Scrollable(src => src.Height(230)) 

To też załatwi sprawę.

Powiązane problemy