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

Trying to get dataSource.sync() to fire when hit delete - not working

3 Answers 635 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 09 Jun 2016, 03:52 PM

Hi.

I'm trying to get my inline delete buttons to work when I click OK. I know, I know, I've read about the autosync property but I don't want that on, because whenever I make a change to a field, it's making a change to the DB, I don't want that.

I want to achieve: when the user clicks delete, and clicks OK confirming the deletion, the dataSource.sync gets called to actually make the deletion/change in my web api controller.

I did this.

                                        remove: function (e) {
                                            dataSource.sync();
                                        },

And it doesn't make the change apparently. It certainly removes it from the model, as the row's getting deleted, but I click cancel, and it comes back. So this isn't firing.

Any help is appreciated. Thanks.

 

3 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 09 Jun 2016, 07:05 PM

This seems to be a matter of trial and error here; hitting the right properties. Editable: "inline" allows deletion to work fine, but it seems to stop "inline editing (which makes no sense to me)." Editable: true, seems to allow inline editing, but not deletion.

Still working it out...

0
Boyan Dimitrov
Telerik team
answered on 13 Jun 2016, 01:55 PM

Hello Michael,

Could you please confirm that you are trying to achieve the functionality in the http://dojo.telerik.com/ECohe example? 

Regards,
Boyan Dimitrov
Telerik
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Michael
Top achievements
Rank 1
answered on 13 Jun 2016, 03:30 PM

Hi. I actually ended up figuring this out myself. I had to change how I'm doing things than what I'm used to, but for now, it works. What I'm doing is this edit mode, "inline".

$('span.k-grid-delete').on("click", function () {
    RemoveRow();
});

function RemoveRow()
{
    var grid = $('#gridLineItems').data('kendoGrid');
    grid.removeRow("tr:eq(1)");
    dataSource.sync();
}

Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or