JTable Plugin updateAction

时间:2015-07-29 00:27:19

标签: jquery swing jtable

I am having a problem with the update action in JTable Plugin. Wondering if you please shed some light on it. Would appreciate very much. When I edit a record I get the Model and Model Year dropdowns. They are being successfully populated via AJax calls. The problem is when I save my Model and Model Year choices the record changes are not reflecting on the row that I am editing. On the server side (struts Java) I am sending back the edited row based on what was picked in the dropdowns. The JSON response is in the exact format required, identical to what is expected during update action.

Is there anyway to make JTable replace the edited row with the values returned in the JSON object. Here is my client side code:

 var staffMembers = {};
 var sally = new StaffMember("Sally", 5);
 staffMembers['sally'] = sally;

1 个答案:

答案 0 :(得分:0)

将recordUpdated函数添加到脚本中。以下是更新或插入后如何重新加载jTable的示例:

recordAdded: function(event, data){
    $('#ModelMYContainer').jtable('load');
},
recordUpdated: function(event, data){
    $('#ModelMYContainer').jtable('load');
}

您可以使用相同的功能更新单行。

在此处查看更多信息:http://jtable.org/ApiReference/Events#event-recordUpdated