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

Creating a custom delete button - how do actually delete the row

1 Answer 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AspenSquare
Top achievements
Rank 1
AspenSquare asked on 19 Nov 2012, 04:36 PM
I'm trying to create a custom Delete button for my grid that fires off a custom function. The only problem I'm having is actually deleting the row from the grid. How could I accomplish this?

1 Answer, 1 is accepted

Sort by
0
AspenSquare
Top achievements
Rank 1
answered on 19 Nov 2012, 08:04 PM
I just ended up repopulating my grid on success.


var deleteProperty = function (id, propName) {
            var grid = $("#Grid").data("kendoGrid");
            var conDelete = confirm("Would you like to delete " + propName + "?");
            var propertyId = id;
            if (conDelete == true) {
                $.ajax({
                    type: "DELETE",
                    url: "/Property/Delete",
                    data: { "id": propertyId },
                    success: function (data) {
                        alert(data.Message);
                        grid.dataSource.read();
                    },
                    error: function () {
                        alert("There was an error attempting to delete the property.");
                    }
                });
            }
        };
Tags
Grid
Asked by
AspenSquare
Top achievements
Rank 1
Answers by
AspenSquare
Top achievements
Rank 1
Share this question
or