Advertisement
Guest User

Untitled

a guest
Sep 28th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. angular.module('myApp', ['smart-table'])
  2. .controller('mainCtrl', ['$scope',
  3. function ($scope) {
  4. $scope.rowCollection = [
  5. {firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: 'whatever@gmail.com'},
  6. {firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
  7. {firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
  8. ];
  9.  
  10. $scope.rowCollection2 = [
  11. {first: 'Shilan', last: 'kalhor', birth: new Date('1987-05-21'), balance: 102, email: 'whatever@gmail.com'},
  12. {first: 'Shadi', last: 'Kalhor', birth: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
  13. {first: 'Parvaneh', last: 'Khazaee', birth: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
  14. ];
  15. }
  16. ]);
  17.  
  18. <table st-table="rowCollection" class="table table-striped">
  19. <thead>
  20. <tr>
  21. <th st-sort="firstName">first name</th>
  22. <th>last name</th>
  23. <th>birth date</th>
  24. <th>balance</th>
  25. <th>email</th>
  26. </tr>
  27. <tr>
  28. <th><input placeholder="filter by firstname" st-search="firstName"/></th>
  29. <th><input st-search="lastName"/></th>
  30. <th><input placeholder="filter by birth date" st-search="birthDate"/></th>
  31. <th><input placeholder="filter by balance" st-search="balance"/></th>
  32. <th></th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <tr ng-repeat-start="row in rowCollection" ng-click="row.correct = !row.correct">
  37. <td>{{row.firstName}}</td>
  38. <td>{{row.lastName}}</td>
  39. <td>{{row.birthDate | date:'shortDate'}}</td>
  40. <td>{{row.balance}}</td>
  41. <td>{{row.email}}</td>
  42. </tr>
  43. <tr ng-if="row.correct" ng-repeat-end >
  44. <td colspan="5" style="background-color:lightyellow;">
  45.  
  46.  
  47. <table st-table="rowCollection" class="table table-striped">
  48. <thead>
  49. <tr>
  50. <th st-sort="first">first name</th>
  51. <th>last name</th>
  52. <th>birth date</th>
  53. </tr>
  54. <tr>
  55. <th><input placeholder="filter by firstname" st-search="first"/></th>
  56. <th><input st-search="last"/></th>
  57. <th><input placeholder="filter by birth date" st-search="birth"/></th>
  58.  
  59. </tr>
  60. </thead>
  61. <tbody>
  62. <tr ng-repeat="row in rowCollection2" ng-click="row.correct = !row.correct">
  63. <td>{{row.first}}</td>
  64. <td>{{row.last}}</td>
  65. <td>{{row.birth | date:'shortDate'}}</td>
  66.  
  67. </tr>
  68. </tbody>
  69. </table>
  70.  
  71.  
  72.  
  73. </td>
  74. </tr>
  75. </tbody>
  76. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement