ext的ajax提交
程序员文章站
2022-07-10 17:57:06
...
var editForm=Ext.getCmp('formId').form.getValues();// formId为表单id
var beanName = 'bean.';
var bean = {};
for (var i in editForm) {
bean[beanName + i]=editForm[i];
}
var infoArray = [];
var infoStore=Ext.getCmp('list').getStore();// list为一表格id
for (var i = 0; i < infoStore.getCount(); i++) {
infoRecord = infoStore.getAt(i);
if(infoRecord.dirty){
infoArray.push(infoRecord.data);
}
}
bean[grid] = Ext.util.JSON.encode(infoArray);
Ext.Ajax.request({
url : saveUrl,
method:'post',
params : bean,
success : function(form, action) {
Ext.Msg.alert('提示', '操作成功');
},
failure : function(form, action) {
//Ext.Msg.alert('警告', '用户名或密码错误!');
}
})
注意:servlet中所加的属性为bean,grid,其中bean为一对象,grid为一字符串
var beanName = 'bean.';
var bean = {};
for (var i in editForm) {
bean[beanName + i]=editForm[i];
}
var infoArray = [];
var infoStore=Ext.getCmp('list').getStore();// list为一表格id
for (var i = 0; i < infoStore.getCount(); i++) {
infoRecord = infoStore.getAt(i);
if(infoRecord.dirty){
infoArray.push(infoRecord.data);
}
}
bean[grid] = Ext.util.JSON.encode(infoArray);
Ext.Ajax.request({
url : saveUrl,
method:'post',
params : bean,
success : function(form, action) {
Ext.Msg.alert('提示', '操作成功');
},
failure : function(form, action) {
//Ext.Msg.alert('警告', '用户名或密码错误!');
}
})
注意:servlet中所加的属性为bean,grid,其中bean为一对象,grid为一字符串
上一篇: 根据路径选择node
下一篇: ClientConfig