Csharp/C#教程:如何在Kendo Grid MVC中将列宽设置为自动调整分享


如何在Kendo Grid MVC中将列宽设置为自动调整

我用到了具有多列的Kendo网格页面。
我想设置一个列宽自动调整并自动更改宽度。
Plz帮助我,谢谢

@(Html.Kendo().Grid() .Name("grdMarahel_Gardeshkar") .ToolBar(toolbar => toolbar.Custom().Name("btnAddMarhaleh").Text("اضافه").HtmlAttributes(new { id = "btnAddMarhaleh", href = "#" })) .Columns(columns => { columns.Bound(c => c.Code).Width(50).Title("کد"); columns.Bound(c => c.Desc).Width(150).Title("شرح");//Autofit columns.Command(c => c.Destroy().Text("حذف")).Width(70).Title("عملیات"); }) .HtmlAttributes(new { style = "height: 380px;" }) .Scrollable() .Sortable() .Resizable(rl => rl.Columns(true)) .Selectable(sl => sl.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row)) .DataSource(dataSource => dataSource .Ajax() .Model(m => m.Id(p => p.id)) .Read(read => read.Action("Get_DS_Marahel_Gardeshkar", "Home", new { intGardesh = ViewBag.CodeGardeshKar })) .Destroy(del => del.Action("Del_Marhaleh_GardeshKar", "Home"))) ) 

特定于自动调整的列必须将列宽更改为自动调整

一种方法是删除“Scrollable”属性,或者您可以在dataBound事件中使用此函数。

上述就是C#学习教程:如何在Kendo Grid MVC中将列宽设置为自动调整分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

  function Autocolumnwidth(e) { var grid = e.sender; for (var i = 0; i < grid.columns.length; i++) { grid.autoFitColumn(i); } } 

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/954726.html

(0)
上一篇 2021年11月20日
下一篇 2021年11月20日

精彩推荐