daniel-nagy / fixed-table-header

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

Cell width and pagination #42

Open brainwind-software opened 5 years ago

brainwind-software commented 5 years ago

I found out that when using pagination in md-table, the header cells width is not always correct. I switch to page 2 for example, but the header cells do not adapt to the new table layout.

To fix that, you just have to use angulars $timeout function as a wrapper in your setWidth function:

var setWidth = function () {
    $timeout(function () {
        marginTop(height());
        clone.css({
            minWidth: style.width,
            maxWidth: style.width
        });
    });
};

Obviously $timeout also has to be listed in the $inject array and function parameters