tabalinas / jsgrid-webapi

Sample project for jsgrid with WebAPI remote source

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After insertion and deletion how to insert last inserted item to grid and how to remove last deleted item from grid

Itsathere opened this issue · comments

{
    loadData: function(filter) {
        return $.ajax({
            type: "GET",
            url: "/items",
            data: filter,
            dataType: "json"
        });
    },

    insertItem: function(item) {
        return $.ajax({
            type: "POST",
            url: "/items",
            data: item,
            dataType: "json"
        });
    },

    updateItem: function(item) {
        return $.ajax({
            type: "PUT",
            url: "/items",
            data: item,
            dataType: "json"
        });
    },

    deleteItem: function(item) {
        return $.ajax({
            type: "DELETE",
            url: "/items",
            data: item,
            dataType: "json"
        });
    },
}

above code snippet not explain the insertion and deletion of item from grid.

Removal of deleted item and insertion of inserted item should happen automatically. It's defined in the by the load strategy http://js-grid.com/docs/#load-strategies. See finishInsert and finishDelete methods.