bsTable.js 924 B

123456789101112131415161718192021222324252627
  1. // JavaScript source code
  2. (function () {
  3. angular.module('bsTable', [])
  4. .directive('bsTableControl', function () {
  5. return {
  6. restrict: 'EA',
  7. scope: {
  8. options: '='
  9. },
  10. link: function (scope, element, attr) {
  11. var tableCreated = false;
  12. scope.$watch('options', function (newValue, oldValue) {
  13. if (tableCreated && newValue === oldValue) return;
  14. $(element).bootstrapTable('destroy');
  15. if (newValue) {
  16. $(element).bootstrapTable(scope.options);
  17. }
  18. tableCreated = typeof (newValue) !== 'undefined';
  19. });
  20. $(window).resize(function () {
  21. if (tableCreated)
  22. $(element).bootstrapTable('resetView');
  23. })
  24. }
  25. };
  26. })
  27. })();