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

4 posts, 0 answers
  1. Michael
    Michael avatar
    24 posts
    Member since:
    Jan 2016

    Posted 09 Jun 2016 Link to this post

    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.

     

  2. Michael
    Michael avatar
    24 posts
    Member since:
    Jan 2016

    Posted 09 Jun 2016 in reply to Michael Link to this post

    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...

  3. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 13 Jun 2016 Link to this post

    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.
     
  4. Michael
    Michael avatar
    24 posts
    Member since:
    Jan 2016

    Posted 13 Jun 2016 Link to this post

    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();
    }

Back to Top