i am using angular 2 with ng2-smarttable.
I add checkbox in table.Here is my code.
settings = {
mode:"external",
selectMode: 'multi',
columns: {
Check:{
title: '',
type: 'html',
valuePrepareFunction: (value) => { return this._sanitizer.bypassSecurityTrustHtml(this.input); },
filter: false
},
orderby:{
title: "Name",
filter: true
}
}
it's works.But i need get checkbox with event and get selected row.
Kindly advice me,
Thanks.
Add "userRowSelect" event your HTML code as below.
<ng2-smart-table class="table table-bordered" [settings]="settings" [source]="data" (create)="onAdd($event)"
(delete)="onDelete($event)" (userRowSelect)="onUserRowSelect($event)">
</ng2-smart-table>
Add your method as below and it will return all selected rows.
public onUserRowSelect(event) {
var selectedRows = event.selected;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With