├── .gitignore ├── package.json ├── bower.json ├── stStickyHeader.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | bower_components 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "smart-table-sticky-header", 3 | "version": "1.0.1", 4 | "description": "sticky header directive for smart table", 5 | "main": "stStickyHeader.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository":{ 10 | "type":"git", 11 | "url":"https://github.com/lorenzofox3/stStickyHeader.git" 12 | }, 13 | "author": "Laurent Renard", 14 | "license": "MIT" 15 | } 16 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "smart-table-sticky-header", 3 | "version": "1.0.1", 4 | "authors": [ 5 | "lorenzofox3 " 6 | ], 7 | "description": "sticky table header for smart-table", 8 | "main": "stStickyHeader.js", 9 | "license": "MIT", 10 | "ignore": [ 11 | "**/.*", 12 | "node_modules", 13 | "bower_components", 14 | "test", 15 | "tests" 16 | ], 17 | "dependencies": { 18 | "lr-sticky-header": "~1.1.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /stStickyHeader.js: -------------------------------------------------------------------------------- 1 | (function (ng, undefined) { 2 | 'use strict'; 3 | ng.module('smart-table') 4 | .directive('stStickyHeader', ['$window', function ($window) { 5 | return { 6 | require: '^?stTable', 7 | link: function (scope, element, attr, ctrl) { 8 | var stickyHeader = lrStickyHeader(element[0], {headerHeight: attr.stStickyHeaderTop}); 9 | scope.$on('$destroy', function () { 10 | stickyHeader.clean(); 11 | }); 12 | 13 | scope.$watch(function () { 14 | return ctrl.tableState(); 15 | }, function () { 16 | $window.scrollTo(0, lrStickyHeader.treshold); 17 | }, true) 18 | } 19 | } 20 | }]); 21 | })(angular); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # stStickyHeader 2 | sticky table directive for smart-table 3 | 4 | ![stStickeyHeader](http://i.imgur.com/ocN250H.gif) 5 | 6 | ## install 7 | 8 | `bower install st-sticky-header` 9 | 10 | `npm install smart-table-sticky-header` 11 | 12 | ## dependencies 13 | 14 | [lrStickyHeader](https://github.com/lorenzofox3/lrStickyHeader) 15 | 16 | ## example 17 | 18 | ```html 19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 29 |
30 | ``` 31 | 32 | ## License 33 | 34 | stStickyHeader module is under MIT license: 35 | 36 | > Copyright (C) 2016 Laurent Renard. 37 | > 38 | > Permission is hereby granted, free of charge, to any person 39 | > obtaining a copy of this software and associated documentation files 40 | > (the "Software"), to deal in the Software without restriction, 41 | > including without limitation the rights to use, copy, modify, merge, 42 | > publish, distribute, sublicense, and/or sell copies of the Software, 43 | > and to permit persons to whom the Software is furnished to do so, 44 | > subject to the following conditions: 45 | > 46 | > The above copyright notice and this permission notice shall be 47 | > included in all copies or substantial portions of the Software. 48 | > 49 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 50 | > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 51 | > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 52 | > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 53 | > BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 54 | > ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 55 | > CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 56 | > SOFTWARE. 57 | --------------------------------------------------------------------------------