Reputation: 91
I am using ng2-smart-table in my angular project. Smart table is providing built-in add, edit and delete data but I don't want to use it. I want to edit data on another page, like we do for every CRUD operation. I have searched it but I did not find any solution. Does anyone know how I can do this? Thanks in advance!
Upvotes: 2
Views: 1398
Reputation: 4533
I suggest you to make your custom icon with edit icon and put in action. For that block/deactive default edit button.
With that you will get your click event in (custom)="customeEdit($event)"
.
By this way you can use your custom component in ng2-smart-table
.
Upvotes: 2
Reputation: 917
You can redirect user by binding a method to (edit) event. like this.
.html
<ng2-smart-table class="table"
[settings]="settings"
[source]="data"
(deleteConfirm)="onDeleteConfirm($event)"
(rowSelect)="onRowSelect($event)"
(userRowSelect)="onUserRowSelect($event)"
(rowHover)="onRowHover($event)"
(create)="onCreateNewProcessor($event)"
(edit)="onEditData($event)"
(custom)="onCustom($event)"></ng2-smart-table>
.ts
onEditData(event) {
this.router.navigate(["/route/i/want/to", event.data.id]);
}
Upvotes: 1