Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. <table datatable="ng" dt-options="dtOptions" class="table table-striped table-bordered">
  2. <thead>
  3. <tr>
  4. <th>No</th>
  5. <th>Issue</th>
  6. <th>Meeting No.</th>
  7. <th>Department/Unit</th>
  8. </tr>
  9. </thead>
  10. <tbody>
  11. <tr ng-repeat="(key, value) in issueList | groupBy : 'IssueId' | reverse track by $index">
  12. <td ng-class="{read : value[0].AnswerStatus == 1}">{{$index+1}}</td>
  13. <td>{{value[0].Issue}}</td>
  14. <td>{{value[0].MeetingNo}}</td>
  15. <td>
  16. <table class="table table-striped table-bordered" cellspacing="0" width="100%">
  17. <tbody>
  18. <tr ng-repeat="x in value">
  19. <td width="80%">{{x.Department}}/{{x.Unit}}</td>
  20. <td> <a class="btn btn-default waves-effect m-b-5" ng-click="sendDetail(x.IssueId,x.UnitId)"><i class="fa fa-folder-open"></i> Show </a></td>
  21. </tr>
  22. </tbody>
  23. </table>
  24. </td>
  25.  
  26. </tr>
  27.  
  28. </tbody>
  29. </table>
  30.  
  31. $scope.dtOptions =
  32. DTOptionsBuilder.newOptions()
  33. .withOption('stateSave', true)
  34. .withOption('stateDuration', -1)
  35. .withOption('deferRender', true);
  36.  
  37. $http({
  38. method: 'GET',
  39. url: 'http://issue.json'})
  40. .then(function(response) {
  41. $scope.issueList = response.data;
  42. });
  43.  
  44. [{
  45. "IssueId": "1",
  46. "MeetingNo": "1",
  47. "Issue": "Issue title 1",
  48. "Content": "Content 1",
  49. "AnswerStatus": null,
  50. "UnitId": 1,
  51. "Unit": "Unit 1",
  52. "DepartmentId": 1,
  53. "Department": "Department 1"
  54. }, {
  55. "IssueId": "2",
  56. "MeetingNo": "1",
  57. "Issue": "Issue title 2",
  58. "Content": "Content 2",
  59. "AnswerStatus": null,
  60. "UnitId": 5,
  61. "Unit": "Unit 5",
  62. "DepartmentId": 1,
  63. "Department": "Department 1"
  64. }, {
  65. "IssueId": "2",
  66. "MeetingNo": "1",
  67. "Issue": "Issue title 2",
  68. "Content": "Content 2",
  69. "AnswerStatus": 1,
  70. "UnitId": 6,
  71. "Unit": "Unit 6",
  72. "DepartmentId": 1,
  73. "Department": "Department 1"
  74.  
  75. }]
  76.  
  77. <table datatable="" dt-options="dtOptions" dt-columns="dtColumns" class="table table-striped table-bordered">
  78.  
  79. </table>
  80.  
  81. $scope.dtOptions =
  82. DTOptionsBuilder.fromFnPromise(function() {
  83. var defer = $q.defer();
  84. $http({
  85. method: 'GET',
  86. url: 'http://issue.json'
  87. }).then(function(result) {
  88. defer.resolve(result.data);
  89. });
  90. return defer.promise;
  91. })
  92. .withOption('stateSave', true)
  93. .withOption('stateDuration', -1)
  94. .withOption('deferRender', true); //the very reason to use promise for performance booth
  95.  
  96. $scope.dtColumns = [
  97. DTColumnBuilder.newColumn(null).withTitle('No')
  98. .renderWith(function(data, type, full, meta) {
  99. return (meta.row+1);
  100. }),
  101. DTColumnBuilder.newColumn('Issue').withTitle('Issue'),
  102. DTColumnBuilder.newColumn('MeetingNo').withTitle('Meeting No.'),
  103. DTColumnBuilder.newColumn('Department').withTitle('Department/Unit'),
  104. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement