【问题标题】:jsgrid returns blank line after updatejsgrid 更新后返回空行
【发布时间】:2018-09-19 01:38:27
【问题描述】:

在 jsgrid 中通过 ajax 进行更新后,该行返回空白

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

在url更新的返回:/app/Play/change.php

我以普通 json 格式返回更新后的记录数据,与加载中使用的初始 json 相同

【问题讨论】:

  • 你能做一些有用的小提琴吗?

标签: jsgrid


【解决方案1】:

已解决:

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

【讨论】:

  • 一个好的答案有一个更好的解释。请说明您是如何解决问题的?
  • 对我来说,问题在于 JSON 响应是 pascalCase 而不是 CamelCase(.NET Core 问题..)。然后我将默认设置切换为 camelCase
猜你喜欢
  • 2012-12-21
  • 1970-01-01
  • 1970-01-01
  • 2019-12-14
  • 1970-01-01
  • 2014-11-16
  • 1970-01-01
  • 2018-06-07
  • 1970-01-01
相关资源
最近更新 更多