Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zebra styling #83

Open
aleixjf opened this issue Jan 14, 2022 · 0 comments
Open

Zebra styling #83

aleixjf opened this issue Jan 14, 2022 · 0 comments

Comments

@aleixjf
Copy link

aleixjf commented Jan 14, 2022

Good afternoon!
So the issue is that on the original Mat Table I used the odd/even to assign each row a different class and apply "zebra styling":

        <tr
          mat-header-row
          *matHeaderRowDef="displayedColumns; sticky: true"
        ></tr>
        <!-- INFO: We will set odd when it's really even because the header row is also counted! -->
        <tr
          mat-row
          *matRowDef="let row; let even = even; columns: displayedColumns"
          [ngClass]="{ odd: even, even: !even }"
        ></tr>

The issue is that once I use your Directive, the odd/even are reassigned every time an item enter/leaves the visible section, I presume, and it alters the odd/even property to its opposite. The problem is that the CSS is reapplied to that row with the opposite style (on all rows simultaneously), creating a very bad visual effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant