daniel-nagy / fixed-table-header

Fixed table header directive.
MIT License
88 stars 36 forks source link

Support with md-data-table #6

Closed pdore-netfore closed 8 years ago

pdore-netfore commented 8 years ago

I have an md-data-table:

<md-table-container>
        <table md-table>
            <thead md-head md-order="order" md-on-reorder="onReorder">
                <tr md-row>
                    <th md-column ng-repeat="column in columns" md-order-by="{{column.name}}"><span translate="{{column.name}}"></span></th>
                </tr>
            </thead>
            <tbody md-body>
                    <tr md-row ng-repeat="item in items | orderBy: order">
                        <td md-cell ng-repeat-start="column in columns">
                            ...
                        </td>
                    </tr>
            </tbody>
        </table>
</md-table-container>

To add a fixed header, I've added fix-head to the <thead> element and giving the <md-table-container> a fixed height and overflow.

White-space shows above the table on initial load and the header doesn't stick when scrolling.

Please help!

pdore-netfore commented 8 years ago

Seems to be an issues with the use of ng-repeat to populate the th's

daniel-nagy commented 8 years ago

I don't think this plays nice with ng-repeat. #2

If you make a Codepen I'll take a look at it. You can fork the Codepen from the demo, it already uses the data table. Otherwise you may not be able to use ng-repeat within the header.

pdore-netfore commented 8 years ago

Without fix-head http://codepen.io/pdore/pen/XdmeVr?editors=101

With fix-head http://codepen.io/pdore/pen/qZOPxN?editors=101

daniel-nagy commented 8 years ago

ng-repeat should work now, I've also published this to bower and npm.