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

destroy deletes a row even on an error

3 Answers 315 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 03 Aug 2012, 06:42 PM
Clicking the destroy command in my grid will automatically remove the row before regardless of whether or not the server accepts or rejects the transaction. Is there any way around this behavior? In particular, is there a way that I can bind the row removal to the success event for the data source?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Vinicius Veras
Top achievements
Rank 1
answered on 31 Aug 2012, 02:42 AM
I have same problem! Someone already found a solution?
0
Michael
Top achievements
Rank 1
answered on 11 Sep 2012, 08:27 PM
Same problem here. It does not seem like that should be the default behavior.
0
Edmond
Top achievements
Rank 1
answered on 17 Sep 2012, 08:14 PM
You can call cancelChanges on the error callback.
destroy:
function (options) {
        $.ajax( {
                url: crudServiceBaseUrl + "/values",
                data: options.data,
                type: "DELETE",
                dataType: "json",
                success: function(result) {
                    alert("Delete!");
                },
                error: function(result) {
                    $("#grid").data("kendoGrid").cancelChanges();
                    alert("Delete error!");
                }
            });
},
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Vinicius Veras
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Edmond
Top achievements
Rank 1
Share this question
or