我将 KendoUI Grid 与它的 ASP MVC Complete Wrapper 库一起使用,并且在剃刀代码中设置网格的高度时遇到问题。我尝试设置 HTMLAttribute 但似乎不起作用。
@(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"})
)