我正在使用 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"})
)
请尝试以下操作:
.HtmlAttributes(new { style = "height:400px" })
当前设置不起作用,因为Height
不是有效的 HTML 属性DIV
Kendo Grid 正在渲染的元素。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)