1-sharp-sharp-sharp problem description
develop a module that uses the data table of layui. After binding the data table toolbar, you need to use the layui pop-up layer to modify all kinds of data of an entry. After the table band is submitted and modified, how to refresh the value of the corresponding entry in the data table?
methods that have been tried
layui has an obj.update () method, but there seems to be no way to update it directly with the json data returned by the API to modify data [data in the success callback in the following code snippet]. I don"t know how to get the corresponding data table obj entry.
related codes
form.on("submit(submit_edit)", function(data){
var formData = data.field;
formData["_token"] = "{{ csrf_token() }}";
$.ajax({
url: "/order_edit_save", //
method: "POST",
data: formData, // {"info_key": "info_val", ... }
beforeSend: function() {
layhelper.loadD(""); //
},
success: function(data) {
//data : { "code": 0, "msg": "success", "data": [ "info_key": "info_val", ... ] }
layer.closeAll("loading"); //
layer.msg(data.msg); // "success"
table.reload("order_data_grid");
},
error: function() {
layer.closeAll("loading"); //
layer.msg("");
table.reload("order_data_grid");
}
});
return false; //
});
in this case, is there any way to refresh the modified value of the corresponding entry in the data table after the form of the modified form is submitted successfully, or is there something wrong with my idea? Layui is not very familiar. Thank you for your advice.