1

我正在使用jTable插件版本 2.3.0 对动态表进行 CRUD 操作。在此,当我添加一个新行时,它会存储在数据库中。但是创建弹出窗口没有关闭,表格也没有刷新。

但是当我编辑任何行时,编辑弹出窗口会关闭,表格也会关闭。创建仅导致问题的行。

我在 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');
    }

在这两个事件中,每当我编辑任何行时都会调用 recordUpdated 事件。所以桌子也正在刷新。但是 recordAdded 事件根本没有被调用。我不知道缺少什么。任何建议都非常感谢。谢谢。

4

1 回答 1

0

尝试在代码中插入一些警报消息。然后你会知道事件是否被调用。

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

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

更多详情请点击这里

于 2013-06-05T11:47:56.010 回答