2017-11-24 2 views
1

그리드의 세로 스크롤 (예 : 'Freeze Panes'in excel)에서 검도 그리드의 제목 행을 고정하려면 어떻게합니까? 검도 그리드 API를 읽은 후 [headerStyle]="{'position': 'fixed'}" 태그에 kendo-grid-column 태그를 사용해 보았지만 모든 제목이 서로 겹치게되었습니다. 어떤 제안이라도 인정할 만하다.열 제목 고정 검도 그리드 각도 2

답변

1

그런 경우 그리드의 scrollable = 'scrollable'속성을 설정하고 gridContent를 overflow-y auto로 설정해야합니다. 아래와 같이 HTML에서

.k-grid-content { 
    height: inherit; 
    overflow-y: auto; 
} 

설정 그리드 :

<kendo-grid id="grdView" 
     [ngStyle]="setStyles()" 
     [data]="yourDatabse" 
     [scrollable]="'scrollable'" 
     [height]="gridNewHeight" 
> 

그런 다음 아래와 같은 백엔드에서 설정 gridContent 높이 후 :

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; 
} 
+0

당신이 setStyles 내부의 코드를 설명 할 수 있다면 도움이 될 것이다 () 메소드를 사용하고 컨텐츠 영역 높이를 설정하는 이유는 –

+0

입니다. 왜냐하면 우리는 컨텐츠 전체가 아닌 전체 그리드의 높이만 설정하기 때문입니다 –