【允许转载!但请注明出处!】
1、FormPanel表单从后台加载数据
form.getForm().load({
waitTitle:'提示',
waitMsg : "正在加载数据……",
url:'publicManage/organOperate.htm?method=organDetail',
params:{
thiscode:thiscode
},
success:function(form,action){
var record = action.result.data;
},
failure : function(form, action) {
Ext.Msg.alert("提示","数据查询失败");
}
});
使用这种方式需要表单项的name值与后台返回的json结果集中的对象名对应。否则数据加载不上。
2、FromPanel表单提交
Var values : Ext.encode(oneCustomerInfo_form.getForm().getValues());
//取form所有的Value值(json格式数据)
oneCustomerInfo_form.getForm().submit({
url:'customerInfoManage/oneCustomerInfo.htm?method=search',
params:{
customername:oneCustomerInfo_form.getForm().findField('customername').getValue()
values: values
},
success:function(oneCustomerInfo_form,action){
var resultData = action.result.data;
alert(resultData['certno']);
},
failure:function(response){
Ext.Msg.alert('失败','加载数据失败,无对应数据或者系统出现异常!');
}
})
3、Ext的AJAX请求数据
Ext.Ajax.request({
url:'publicManage/organOperate.htm?method=organClose',
params:{
thiscode:arrayCodes
},
success:function(response,option){
var obj = Ext.util.JSON.decode(response.responseText);
if(obj.success==true){
Ext.Msg.alert('提示',obj.msg);
}else{
Ext.Msg.alert('提示',obj.errors);
}
//institutionRegist_GridStore.reload();
//Ext.Msg.alert('消息','成功!');
},
failure:function(response,option){
Ext.Msg.alert('失败',response.responseText);
}
})
后台字符串通过Ext.util.JSON.decode 转成json字符串
不能自动根据json字符串success的值来选择流程 ,需要根据obj.success的值来判断走哪个流程
该failure:可以捕捉系统异常,比如,数据未曾提交到后台或action 不存在,此时走failure 流程
4、GridPanel加载数据
institutionRegist_GridStore.load({
params: {
start:0,
limit:20,
//limit:Ext.getCmp('institutionRegist_pPageSize').getValue(),
thiscode:institutionRegist_form.getForm().findField('from表单项的name').getValue()
},
callback: function(data, options, success) {
if (success) {
} else {
Ext.Msg.alert("提示","加载数据失败,无对应数据或者系统出现异常!");
}
}
})

被折叠的 条评论
为什么被折叠?



