ngtable - AngularJS ng-table fixed headers -
i'm using ng-table display information. make header , footer of ng-table fixed , force ng-table draw scroll bars within rows.
the ng-table documentation site has no documentation on how make happen.
any ideas?
that far reliable solution found. , i've looked hours before deciding use jquery plugin. in version of plugin using, can stick header scrollable container. take @ plunker use case ng-table:
http://plnkr.co/edit/ypbadhifajwapxvs3jcu?p=preview
javascript
app.directive('fixedtableheaders', ['$timeout', function($timeout) { return { restrict: 'a', link: function(scope, element, attrs) { $timeout(function() { var container = element.parentsuntil(attrs.fixedtableheaders); element.stickytableheaders({ scrollablearea: container, "fixedoffset": 2 }); }, 0); } } }]);
html
<div id="scrollable-area"> <table ng-table="tableparams" fixed-table-headers="scrollable-area"> <tr ng-repeat="user in $data"> <td data-title="'name'">{{user.name}}</td> <td data-title="'age'">{{user.age}}</td> </tr> </table> </div>
css
#scrollable-area { height: 150px; overflow-y: scroll; /* <-- here important*/ } table { width: 100%; } thead { background: #fff; }
Comments
Post a Comment