paginatedTable.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Shows table data split into pages.
  3. */
  4. (function() {
  5. (function() {
  6. try {return angular.module('ieat.ui')}
  7. catch {return angular.module('ieat.ui', [])}}
  8. )().component('paginatedTable', {
  9. templateUrl: 'static/templates/paginatedTable.html',
  10. bindings: {
  11. /* Array of data to display in the table. */
  12. tableData: '<',
  13. /*
  14. * Array of columns to display
  15. * Schema:
  16. * name: Header for columns
  17. * col: Property from table data objects to display
  18. * size: Relative size in the table (default: 3)
  19. */
  20. structure: '<',
  21. /* Text to display on select button. */
  22. selectText: '<',
  23. /*
  24. * Function to call when select button clicked.
  25. * If not set, no button will appear.
  26. */
  27. onSelect: '&'
  28. },
  29. controller: ['$scope', '$timeout', function($scope, $timeout) {
  30. var self = this;
  31. this.$onInit = function() {
  32. self.selectText = self.selectText || "Add";
  33. $scope.pageOffset = 0;
  34. $scope.pageSize = "10";
  35. };
  36. }]
  37. });
  38. })();