AngularJS ng-table fixed headers

前端 未结 3 1279
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 04:46

I\'m using ng-table to display some information. I would like to make the header and footer of the ng-table fixed and force the ng-table to draw scroll bars within the rows.

3条回答
  •  耶瑟儿~
    2021-01-31 05:25

    I don't know about the footer but I had a similar requirement for the headers.

    This was requested before @ Github: https://github.com/esvit/ng-table/issues/41

    I made my own implementation using a jquery plugin (https://github.com/jmosbech/StickyTableHeaders).

    There is a plunkr here: http://plnkr.co/edit/KyilXo?p=preview

    Basically we just call the plugin in the directive data-fixed-table-headers when the data has been rendered.

    angular.module('main').directive('fixedTableHeaders', ['$timeout', fixedTableHeaders]);
    
        function fixedTableHeaders($timeout) {
            return {
                restrict: 'A',
                link: link
            };
    
            function link(scope, element, attrs) {
    
                $timeout(function () {
                  element.stickyTableHeaders();
                        }, 0);
            }
        }
    

提交回复
热议问题