[英]Dynamic size of telerik grid
I have the following grid in a ASP.NET MVC project. 我在ASP.NET MVC项目中具有以下网格。
<div class="actualGrid" id="actualGrid">
@(Html.Kendo().Grid<PROJECT.Models.Bench>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.name).Title("Bench").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))).Width(125);
columns.Bound(p => p.freeSeats).Title("Free Seats").Width(350);
columns.Command(command => { command.Custom("checkBench1 ").Text(" AM ").Click("doCheckIn"); command.Custom("checkBench 2").Text(" PM ").Click("doCheckIn"); command.Custom("checkBench3").Text("All Day").Click("doCheckIn"); }).Width(250).Title("Check in");
})
//.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Scrollable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.HtmlAttributes(new { style = "height:530px;" })
.Events(events => events.DataBound("onDataBound"))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.id))
.Read(read => read.Action("GetBenches", "Home"))
)
)
</div>
I would like to know if there is a way to change the size(height)
of the grid according to the number of results I have when I use filter. 我想知道是否有一种方法可以根据使用过滤器时得到的结果数来更改网格的
size(height)
。
For Example if I filter first column and get 1 result grid would be small, and if I had 10 results it would be larger. 例如,如果我过滤第一列并得到1个结果网格将很小,而如果我有10个结果它将更大。
为此使用此行:
.Scrollable(scrolling => scrolling.Enabled(false))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.