2017-12-20 3 views
-1

데이터 테이블이 angular-material이고 왼쪽/오른쪽의 특정 열에 정렬해야합니다.데이터 테이블의 열 정렬

<mat-table #table [dataSource]="dataSource" matSort> 

    <ng-container matColumnDef="col0"> 
     <mat-header-cell *matHeaderCellDef mat-sort-header> Col0</mat-header-cell> 
     <mat-cell *matCellDef="let element"> {{element.col0}} </mat-cell> 
    </ng-container> 

    <ng-container matColumnDef="col1"> 
     <mat-header-cell *matHeaderCellDef mat-sort-header> Col1 </mat-header-cell> 
     <mat-cell *matCellDef="let element"> {{element.col1}} </mat-cell> 
    </ng-container> 

    <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> 
    <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row> 
    </mat-table> 

이 작업을 수행하려면 어떤 CSS가 필요합니까?

내가 github의 변경 요청의 형태로 솔루션을 발견 한 몇 가지 인터넷 검색 활동 후

답변

0

: 짧은 형식이 같다 See here

을 :

.mat-column-col1 { 
    display: flex; 
    justify-content: flex-end; 
} 

단지에 COL1 교체 당신이 필요로하는 칼럼!