Declined
Last Updated: 18 May 2021 15:36 by ADMIN
Moussa
Created on: 22 Jan 2020 12:08
Category: Grid
Type: Feature Request
0
It will be great if we had the possibility to confirm the deletion of a record before it disappears from a Grid.

Reproduction

- Use a grid with data coming from a service (or another source)

- Click the delete button (built in with the grid

It removes the element from the grid as soon as I click the button but I want to remove it only after confirming the deletion.

1 comment
ADMIN
Martin Bechev
Posted on: 28 Jan 2020 14:23

Hi Moussa,

Thank you for your feedback.

In general, when the user clicks on the 'Remove' button the removeHandler function is invoked. A possible approach is to use the Angular Service of the Dialog component to show a confirmation dialog when the remove event is fired. Depending on the returned result the row can be removed:

public removeHandler({ dataItem }) {
    const dialog: DialogRef = this.dialogService.open({
      title: "Please confirm",
      content: this.template,
      actions: [{ text: "No" }, { text: "Yes", primary: true }],
      width: 450,
      height: 200,
      minWidth: 250
    });

    dialog.result.subscribe((result: any) => {
      if (result.text === "Yes") {
        this.editService.remove(dataItem);
      }
    });
  }

Please check the following StackBlitz which demonstrate the suggestion:

https://stackblitz.com/edit/angular-wnhpmh?file=app%2Fapp.component.ts

I hope this helps. Let me know if I can assist any further.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.