jTable插件:添加新行后,动态表不会刷新

jTable Plugin : The dynamic table is not getting refreshed after adding a new row

本文关键字:动态 刷新 插件 添加 新行 jTable      更新时间:2023-09-26

我使用jTable插件版本2.3.0对动态表进行CRUD操作。在这种情况下,当我添加一个新的行,它被存储在数据库中。但是create弹出窗口没有被关闭,表也没有被刷新。

但是当我编辑任何一行,然后编辑弹出窗口关闭,表也被关闭。创建只会导致问题的行

在js.

//Register to selectionChanged event to hanlde events                                     
    recordAdded: function(event, data){
        //after record insertion, reload the records
        $('#PriorIncidentTable').jtable('load');
    },
    recordUpdated: function(event, data){
        //after record updation, reload the records
        $('#PriorIncidentTable').jtable('load');
    }

在这两个事件中,每当我编辑任何一行时,就会调用recorduupdated事件。表格也会被刷新。但是recordAdded事件根本没有被调用。我不知道我错过了什么。任何建议都非常感谢。谢谢。

尝试在代码中插入一些警告消息。然后您将知道事件是否正在被调用。

如果数据被存储在db意味着,那么一些确认消息应该返回给jquery。因此,请检查服务器端代码以获取返回数据。你的createAction必须返回新创建的记录(作为JSON对象)!createAction的示例返回值可以是:

{
   "Result":"OK",
   "Record":{"PersonId":5,"Name":"Dan Brown","Age":55,"RecordDate":"'/Date(1320262185197)'/"}
}

详情请点击这里