md-table - How to update the column width

后端 未结 18 2162
离开以前
离开以前 2020-12-04 10:58

I have started using the md-table for my project, and I want fixed column width. Currently all columns width are divided into equal size.

Where can I get the documen

18条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 11:21

    If you have too many table column and it is not adjusted in angular table using md-table, then paste the following style in component.css file. It will work like a charm with scroll view horizontally.

    .mat-table__wrapper .mat-table {
        min-width: auto !important;
        width: 100% !important; }
    
    .mat-header-row {
        width: 100%; }
    
    .mat-row {
        width: 100%;
    }
    

    Add this style to alter your column separately.

    .mat-column-{colum-name} {
        flex: 0 0 25% !important;
        min-width: 104px !important;
    }
    

    Alternatively check this link, (where the code above came from), for more detail.

提交回复
热议问题