最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Extjs优化二 Form表单提交通用实现
时间:2026-06-12 09:59:01 编辑:袖梨 来源:一聚教程网

复制代码 代码如下:
/**
* 提交表单
*/
function $postForm(a) {
if (a.formPanel.getForm().isValid()) {
var b = a.scope ? a.scope: this;
a.formPanel.getForm().submit({
scope: b,
url: a.url,
method: "post",
params: a.params,
waitMsg: "正在提交数据...",
success: function(c, d) {
Ext.ux.Toast.msg("操作信息", "成功信息保存!");
if (a.callback) {
a.callback.call(b, c, d);
}
},
failure: function(c, d) {
Ext.MessageBox.show({
title: "操作信息",
msg: "信息保存出错,请联系管理员!",
buttons: Ext.MessageBox.OK,
icon: "ext-mb-error"
});
if (a.callback) {
a.callback.call(b);
}
}
});
}
}
使用改代码只需要13行代码 原始需要25-30行代码搞定 ,示例:
复制代码 代码如下:
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();
}
});
相关文章
- 《仙境复兴法师技能加点攻略》(掌握关键技能,打造强力法师) 06-14
- 零一万物常见问题:开发者接入的5个排查点 06-14
- 零一万物怎么用?6月办公场景3种方法 06-14
- 百川智能新手教程怎么用?3种场景设置技巧 06-14
- 广汽传祺app怎么预约保养 广汽传祺app预约保养方法 06-14
- 月之暗面低成本替代方案:如何用更低预算获得相近效果?4步筛选法 06-14