Hello. Is it possible to hide scroll on grid if data list is short and show when it's big? For example when we filter data list.
I found only this solution:
<
input
type
=
"text"
#filterInput
placeholder
=
"Search"
(keyup)="itemsFilter(filterInput.value)" />
<
kendo-grid
class
=
"grid-customized-border"
[style.height.px]="300"
scrollable
=
"scrollable"
[data]="gridView"
[sortable]="{
allowUnsort: allowUnsort,
mode: 'single'
}"
[sort]="sort"
(sortChange)="sortChange($event)"
[selectable]="true"
[kendoGridSelectBy]="'id'"
[selectedKeys]="selectedRows"
#grid
>
itemsFilter(value) {
if (value) {
this.gridView.data = this.gridView.data(item => {
return item.title.toLowerCase().indexOf(value.toLowerCase()) === 0
});
}
setTimeout(() => this.toggleScroll());
}
public toggleScroll() {
if (this.grid) {
let el = this.grid.nativeElement,
content = el.querySelectorAll('.k-grid-content')[0],
table = el.querySelectorAll('.k-grid-table-wrap')[0],
header = el.querySelectorAll('.k-grid-header')[0];
if (table && content) {
if (table.offsetHeight < content.offsetHeight) {
content.style.cssText = 'overflow-y: auto';
header.style.cssText = 'padding: 0';
} else {
header.style.cssText = 'padding: 0 16px 0 0';
}
}
}
}