How to use selectionMode: 'multiple', displaySelectionCheckbox: true properties in angularjs smart table -
http://lorenzofox3.github.io/smart-table-website/#/section-selection
how utilize selectionmode: 'multiple', displayselectioncheckbox: true properties in smart table. requirements?
let's suppose have next table in html. should create next directive (you can set in separated file form controller):
<table st-table="rowcollection" class="table"> <thead> <tr> <th></th> <th st-sort="firstname">first name</th> <th st-sort="lastname">last name</th> <th st-sort="birthdate">birth date</th> <th st-sort="balance">balance</th> <th>email</th> </tr> </thead> <tbody> <tr ng-repeat="row in rowcollection"> <td cs-select="row"></td> <td>{{row.firstname | uppercase}}</td> <td>{{row.lastname}}</td> <td>{{row.birthdate | date}}</td> <td>{{row.balance | currency}}</td> <td><a ng-href="mailto:{{row.email}}">email</a></td> </tr> </tbody> </table> app.controller('customctrl', ['$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'} ]; }]); app.directive('csselect', function () { homecoming { require: '^sttable', template: '<input type="checkbox"/>', scope: { row: '=csselect' }, link: function (scope, element, attr, ctrl) { element.bind('change', function (evt) { scope.$apply(function () { ctrl.select(scope.row, 'multiple'); }); }); scope.$watch('row.isselected', function (newvalue, oldvalue) { if (newvalue === true) { element.parent().addclass('st-selected'); } else { element.parent().removeclass('st-selected'); } }); } }; }); angularjs smart-table
No comments:
Post a Comment