5

is there any way how to set different width for column ?

After many tries, it seems columns are even, ignoring all styles.

1

2 Answers 2

8

yes, it is possible using css .mat-column-<matColumnDef-value>, suppose you have a column def "group" like:

<!-- Group Column -->
<ng-container matColumnDef="group">
  <mat-header-cell *matHeaderCellDef mat-sort-header>Group</mat-header-cell>
  <mat-cell *matCellDef="let element">
    {{element.group}}
  </mat-cell>
</ng-container>

In the css you can set the width:

.mat-column-group {
  width: 150px;
  max-width: 150px;
}
Sign up to request clarification or add additional context in comments.

1 Comment

is there any way to define same size for the column even screen size changes? stackoverflow.com/questions/65296518/…
0

this is awkward, it is not possible to override styles by width... min-width has to be applied.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.