Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 冻结列标题剑道网格角度2_Angular_Kendo Grid - Fatal编程技术网

Angular 冻结列标题剑道网格角度2

Angular 冻结列标题剑道网格角度2,angular,kendo-grid,Angular,Kendo Grid,垂直滚动网格时,如何冻结剑道网格的标题行(就像excel中的“冻结窗格”一样)?在阅读了剑道网格api之后,我尝试在剑道网格列的标签中使用[headerStyle]=“{'position':'fixed'}”,但它会使所有标题相互重叠。任何建议都是可以接受的。在这种情况下,您必须设置grid的scrollable='scrollable'属性,并将gridContent设置为overflow-y auto .k-grid-content { height: inherit; o

垂直滚动网格时,如何冻结剑道网格的标题行(就像excel中的“冻结窗格”一样)?在阅读了剑道网格api之后,我尝试在剑道网格列的标签中使用
[headerStyle]=“{'position':'fixed'}”
,但它会使所有标题相互重叠。任何建议都是可以接受的。

在这种情况下,您必须设置grid的scrollable='scrollable'属性,并将gridContent设置为overflow-y auto

.k-grid-content {
    height: inherit;
    overflow-y: auto;
}
在HTML中设置网格,如下所示:

<kendo-grid id="grdView" 
        [ngStyle]="setStyles()"
        [data]="yourDatabse"
        [scrollable]="'scrollable'"
        [height]="gridNewHeight"
>
let height:number=300;
public setStyles(): any {
    this.gridNewHeight = this.height;

    let styles = {
        'height': (this.gridNewHeight - 45) + 'px'
    };

    let gridHeaderHeight: number =40;

    let gridContent: any = this.el.nativeElement.getElementsByClassName('k-grid-content')[0];
    if (gridContent != null) {
       gridContent.style.height = (this.gridNewHeight - (gridHeaderHeight )) + 'px';
    }

    return styles;
}

如果您可以解释setStyles()方法中的代码,以及我们为什么要这样做来设置内容区域高度,这将非常有用,因为我们只设置整个网格的高度,而不是内容的高度