/*** Submit the form */function $ postform (a) {If (A. formpanel. getform (). isvalid () {var B = A. Scope? A. scope: This;. formpanel. getform (). submit ({scope: B, URL:. URL, method: "Post", Params:. params, waitmsg: "submitting data... ", success: function (c, d) {Ext. UX. toast. MSG ("operation information", "saved successfully! "); If (. callback) {. callback. call (B, c, d) ;}}, failure: function (c, d) {Ext. messageBox. show ({Title: "operation information", MSG: "An error occurred while saving the information. Please contact the administrator! ", Buttons: ext. messageBox. OK, icon: "ext-MB-error"}); if (. callback) {. callback. call (B );}}});}}
ChangeCodeOnly 13 lines of original code need 25-30 lines of code. Example:
Saverecord: function () {$ postform ({formpanel: This. formpanel, scope: This, URL: _ ctxpath + "/basedata/savestudentdepartment. action ", Params :{}, callback: function (d, f) {var E = ext. getcmp ("studentdepartmentgrid"); If (E! = NULL) {e. getstore (). Reload () ;} B. Close ();}});