如何使Kendo网格中的滚动条自动启用或禁用? [英] How to make scrollbar auto enabled or disabled in a Kendo grid?

查看:703
本文介绍了如何使Kendo网格中的滚动条自动启用或禁用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我创建网格的代码:

  @ {
if(Model.GenericEntityList.Count> ; 0)
{
@(Html.Kendo().Grid(Model.GenericEntityList).Name(screenNames.ToString())。Columns(
columns =>
{
columns.Bound(a => a.ID).Title(< input id ='checkAll'type ='checkbox'/>\").ClientTemplate(\"<input type ='checkbox 'ID =#= genericCheckbox(ID,ViewFlag)#)。Width(7);
columns.Bound(a => a.Name).Title(screen.ToString()+Name)。 Width(93);
}
).Selectable()。Scrollable()。DataSource(
datasource =>
datasource.Ajax()。Read(read => read.Action(CompSetHide,Compset))
).Events(a => a.Change(rowclick)

.HtmlAttributes(new {style = height:185px;})

}





$ b

如何禁用并启用自动出现在剑道网格内的垂直滚动条?

解决方案

您可以使用像这样的东西来显示垂直滚动条:

  $(#grid .k-grid-content)。css({
overflow-y:scroll
});

这个可以隐藏它:

<$ p (
overflow -y:hidden
}); $ p> $(#grid .k-grid-content

其中 grid 是网格的ID元素。


This is my code for creating the grid:

@{
    if (Model.GenericEntityList.Count > 0)
    {
        @(Html.Kendo().Grid(Model.GenericEntityList).Name(screenNames.ToString()).Columns(
              columns =>
                  {
                      columns.Bound(a => a.ID).Title("<input id='checkAll' type='checkbox' />").ClientTemplate("<input type='checkbox' id=#=genericCheckbox(ID,ViewFlag)#").Width(7);
                      columns.Bound(a => a.Name).Title(screen.ToString() + " Name").Width(93);
                  }
              ).Selectable().Scrollable().DataSource(
                  datasource =>
                  datasource.Ajax().Read(read => read.Action("CompSetHide", "Compset"))
              ).Events(a => a.Change("rowclick")
              )
              .HtmlAttributes(new {style = "height: 185px;"}) 
              )
    }
}

How can I disable and enable the vertical scrollbar that appears inside the kendo grid automatically?

解决方案

You can use something like this to show the vertical scroll bar:

$("#grid .k-grid-content").css({
    "overflow-y": "scroll"
});

and this to hide it:

$("#grid .k-grid-content").css({
    "overflow-y": "hidden"
});

where grid is the id of your grid element.

这篇关于如何使Kendo网格中的滚动条自动启用或禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆