Search code examples
jsgrid

jsgrid returns blank line after update


After giving an update via ajax in jsgrid the line returns blank

controller: {
    loadData: function(filter) {
        var data = $.Deferred();
        $.ajax({
            type: "GET",
            contentType: "application/json; charset=utf-8",
            url: "/app/Play/",
            dataType: "json"
        }).done(function(response) {
            data.resolve(response);
        });
        return data.promise();
    },
    updateItem: function(item) {
        return $.ajax({
            type: "POST",
            url: "/app/Play/change.php",
            data: item,
        });
    },
}

In the return of the url update: /app/Play/change.php

I return the updated record data in a normal json, same as the initial json used in the load


Solution

  • Resolved:

    controller: {
        loadData: function(filter) {
            var data = $.Deferred();
            $.ajax({
                type: "GET",
                contentType: "application/json; charset=utf-8",
                url: "/app/Jogos/app/",
                data: filter, // <--Insert line, this is a problem
                dataType: "json"
            }).done(function(response) {
                data.resolve(response);
            });
            return data.promise();
        },
        updateItem: function(item) {
            return $.ajax({
                type: "POST",
                url: "/app/Jogos/app/change.php",
                data: item
            });
        },
    },