jquery-datatable-jeditable 在浏览器中显示编辑的值,但不保存在 DOM 中

jquery-datatable-jeditable showing edited value in browser but not saving in DOM

本文关键字:保存 存在 DOM 浏览器 显示 编辑 jquery-datatable-jeditable      更新时间:2023-09-26

我在下面的帖子中为可编辑插件。使用 Jquery 数据表可编辑,无需必填字段 URL。(我希望用户编辑表格,一旦完成,用户可以单击提交按钮并发送它进行处理。一切正常,数据正在编辑,我可以在表格中看到更新的值,但是当我单击Sumbit按钮时,在服务器端我得到了旧值。我不知道我在这里错过了什么。此外,如果我对html页面进行"查看源代码",我看不到更新的值,尽管我可以在浏览器中看到更新的值:-

  $(document).ready(function() { /* Init DataTables */
        var oTable = $('table').dataTable();
        /* Apply the jEditable handlers to the table */
        var theCallback = function(v, s) {
            console.debug("Element", this);
            console.debug("New value:", v);
            console.debug("Setting object:",s);
            return v;
        };
        $(oTable).find('td').editable(theCallback, {
            "callback": function(sValue, y) {
                console.log("jEditable callback is executed => updating dataTable");
                var aPos = oTable.fnGetPosition(this);
          alert(sValue);

    }
        });
    });

最后,我把更新表数据的想法留在了客户端。我遵循了很棒的文章 http://www.codeproject.com/Articles/193068/Adding-data-management-CRUD-functionalities-to-the 并使用了服务器端方法。现在我正在做ajax调用来更新表的数据,Ajax调用将调用UpdateDataServlet并在客户端更新表的列的数据并刷新表。我一直在努力寻找解决问题的方法。希望这对某人有所帮助。