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!
Asked
Active
Viewed 1,291 times
2 Answers
2
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
.

Sachin Shah
- 4,503
- 3
- 23
- 50
-
Hey, @Sachin Shah it is working but i am not able to add multiple custom buttons in table – Kinjal Dec 22 '18 at 12:48
-
@KinjalVithalani You have to add your all custom buttons in `custom[]` array. – Sachin Shah Dec 22 '18 at 19:20
1
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]);
}

Yoarthur
- 909
- 9
- 20
-
-
import { VisitGymModule } from './smart-table-demo/smart-table.module' into the router app.module. And also fix the bugs you've and send me the link again. – Yoarthur Dec 20 '18 at 05:13
-
I have added module in app.module.ts still not working. And also I have added dependency for smart table then also it is not importing properly! @Yoarthur – Kinjal Dec 20 '18 at 05:39