How to make scrollbar auto enabled or disabled in a Kendo grid?

妖精的绣舞 提交于 2019-12-05 05:27:23

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.

You can add .Scrollable(scrollable => scrollable.Virtual(true))

@{
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(scrollable => scrollable.Virtual(true))
.DataSource(
              datasource =>
              datasource.Ajax().Read(read => read.Action("CompSetHide", "Compset"))
          ).Events(a => a.Change("rowclick")
          )
          .HtmlAttributes(new {style = "height: 185px;"}) 
          )
}
}

Use the k-scrollable attribute

<kendo-grid k-scrollable="false" ... />

Below CSS should fix the issue and remove the vertical scrolling as decribed at http://docs.telerik.com/kendo-ui/controls/data-management/grid/appearance#scrolling.

#GridID .k-grid-header
{
   padding: 0 !important;
}

#GridID .k-grid-content
{
   overflow-y: visible;
}

If you are using a kendo grid with nested kendo grid in each row and scrolling virtual.(using angular 5) case 1: After expand the and scroll the skip take last count.

sol: use [detailRowHeight] = "36" in parent grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!