Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('myApp', ['smart-table'])
- .controller('mainCtrl', ['$scope',
- function ($scope) {
- $scope.rowCollection = [
- {firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: 'whatever@gmail.com'},
- {firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
- {firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
- ];
- $scope.rowCollection2 = [
- {first: 'Shilan', last: 'kalhor', birth: new Date('1987-05-21'), balance: 102, email: 'whatever@gmail.com'},
- {first: 'Shadi', last: 'Kalhor', birth: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
- {first: 'Parvaneh', last: 'Khazaee', birth: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
- ];
- }
- ]);
- <table st-table="rowCollection" class="table table-striped">
- <thead>
- <tr>
- <th st-sort="firstName">first name</th>
- <th>last name</th>
- <th>birth date</th>
- <th>balance</th>
- <th>email</th>
- </tr>
- <tr>
- <th><input placeholder="filter by firstname" st-search="firstName"/></th>
- <th><input st-search="lastName"/></th>
- <th><input placeholder="filter by birth date" st-search="birthDate"/></th>
- <th><input placeholder="filter by balance" st-search="balance"/></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat-start="row in rowCollection" ng-click="row.correct = !row.correct">
- <td>{{row.firstName}}</td>
- <td>{{row.lastName}}</td>
- <td>{{row.birthDate | date:'shortDate'}}</td>
- <td>{{row.balance}}</td>
- <td>{{row.email}}</td>
- </tr>
- <tr ng-if="row.correct" ng-repeat-end >
- <td colspan="5" style="background-color:lightyellow;">
- <table st-table="rowCollection" class="table table-striped">
- <thead>
- <tr>
- <th st-sort="first">first name</th>
- <th>last name</th>
- <th>birth date</th>
- </tr>
- <tr>
- <th><input placeholder="filter by firstname" st-search="first"/></th>
- <th><input st-search="last"/></th>
- <th><input placeholder="filter by birth date" st-search="birth"/></th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat="row in rowCollection2" ng-click="row.correct = !row.correct">
- <td>{{row.first}}</td>
- <td>{{row.last}}</td>
- <td>{{row.birth | date:'shortDate'}}</td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement