简体   繁体   中英

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

I'm using jTable plugin version 2.3.0 for CRUD operations on a dynamic table. In this, when i add a new row it is getting stored in the DB. But the create popup window is not getting closed and the table also is not getting refreshed.

But when i edit any row, then the Edit popup window closes and the table also getting closed. Create row only causing problem.

There are two events i added in the 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');
    }

In these two events, recordUpdated event is getting called whenever i edit any row. So the table also is getting refreshed. But The recordAdded event is not at all getting called. I dont know what am missing. Any suggestion is much appreciated. Thanks.

Try to insert some alert messages inside the code. Then you'll know whether the event is getting called or not.

If the data is getting stored in db means then some confirmation message should be return to the jquery. So check your server side code for the return data. Your createAction must return newly created record (as JSON object)! A sample return value for createAction can be:

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

For more details Click Here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM