How to make Angular material table responsive

I have a simple table with many columns and I would like the columns to automatically shrink when customizing the browser window. table-responsive

works with Bootstrap, but I'm looking for something similar for Angular Material. I'm trying to avoid having two table definitions and don't want to do it myself in CSS. Is there a standard way in Angular Stuff to do this?

<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp" flex>
    <thead>
        <th class="mdl-data-table__cell--non-numeric">Date</th>
        <th class="mdl-data-table__cell--non-numeric">Time</th>
        <th class="mdl-data-table__cell--non-numeric">Park</th>
        <th class="mdl-data-table__cell--non-numeric">Home Team</th>
        <th class="mdl-data-table__cell--non-numeric">Away Team</th>
        <th class="mdl-data-table__cell--non-numeric">Win/Loss</th>
    </thead>
    <tbody>
        <tr ng-repeat="game in games">
            <td class="mdl-data-table__cell--non-numeric">{{game.GameDate | SLS_Date}}</td>
            <td class="mdl-data-table__cell--non-numeric">{{game.GameTime | SLS_Time:'HH:mm' }}</td>
            <td class="mdl-data-table__cell--non-numeric">{{game.VenueName}}</td>
            <td class="mdl-data-table__cell--non-numeric">{{game.HomeTeamName}}</td>
            <td class="mdl-data-table__cell--non-numeric">{{game.AwayTeamName}}</td>
            <td class="mdl-data-table__cell--non-numeric">{{game.WinLoss}}</td>
        </tr>
    </tbody>
</table>

      

Note. I used the Material Design Lite spreadsheet here since Angular There is no table in the material today. The same problem, including the use of flexes and grids.

I'm guessing the new material world doesn't like tables, so changing the layout to not use tables is your best bet.

+3


source to share


1 answer


Currently you cannot achieve this in MDL, have a look at this issue on github.

I have the same problem with my tables, but I guess I'll have to make them react to myself. There are many tutorials out there, and you should do a little research on which table design best suits your responsive website.



Also, I find it worth checking out manizecss responsive tables

+2


source







All Articles