This is a migrated thread and some comments may be shown as answers.

Add Commands to Edit Popup

1 Answer 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mis
Top achievements
Rank 1
Mis asked on 28 Aug 2013, 12:01 PM
 We need to add Destroy(Delete) command inside Edit Popup of Kendo Grid.
So edit popup will have 3 buttons, (1)Update (2)Cancel (3)Delete
Please provide steps/details to achieve this if it is possible.

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 29 Aug 2013, 12:34 PM
Hello Mis,

To achieve this you can:
  1. Hook up to the edit event of the grid.
  2. Append delete button to controls container
  3. Hook up to the click event of the appended button
  4. Find the uid of the edited record
  5. Remove it from the DataSource through the remove method.

For example:
edit: function(e) { //1
    e.container
        .find(".k-edit-buttons") //2
        .append('<a class="k-button k-button-icontext k-grid-delete" href="#"><span class="k-icon k-delete"></span>Delete</a>');
 
    e.container.find(".k-button.k-grid-delete").on("click", function(e) { //3
        var uid = $(e.target).closest(".k-popup-edit-form").data("uid"); //4
        dataSource.remove(dataSource.getByUid(uid)); //5
    })
}

For more information please check the Grid and DataSource API reference (section methods/events).
After item is removed the Grid will automatically refresh.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Mis
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or