The code copy is as follows:
$('#form').form({
url : 'test/add.do',
onSubmit : function() {
parent.$.messager.progress({
title: 'Tip',
text : 'Data processing, please wait...'
});
var gridValid = endEdit();// Subtable exit edit verification
if (!gridValid) {
parent.$.messager.progress('close');
return false;
}
var isValid = $('#form').form('validate');
if (!isValid) {
parent.$.messager.progress('close');
return false;
}
// Write the modified and deleted data in the subtable to the hidden input
accept();
return true;
},
success : function(result) {
parent.$.messager.progress('close');
try {
data = eval("(" + result + ")");// Convert JSON string to object
if (data && data.success) {
if (data.msg && data.msg != "")
parent.$.messager.alert('tip', data.msg);
else
parent.$.messager.alert('tip', "Added successfully");
parent.$.modalDialog.openner_grid.datagrid('reload');// Refresh the Gird data
parent.$.modalDialog.handler.dialog('close');// Close the current mode window
} else
parent.$.messager.alert('error', data.msg);// Operation failed
} catch (e) {
parent.$.errorDialog(result);// prompts the server to be abnormal
}
}
});
The above is all about this article, I hope it will be helpful to everyone.