Extjs 最常用的几种过后台方式
跳转方式(1)(当需要导出文件时必须使用这种方式。。。。window.sopen())
var conn = Ext.lib.Ajax.getConnectionObject().conn;
conn.open("POST", '/PowerMS/outInfos.do',false);
conn.setRequestHeader('Content-type','application/x-www-form-urlencoded');
conn.send('attrIds='+encodeURI(cuids)+'&sign='+encodeURI(scope.sign)+'&names='+encodeURI(names));
if(conn.status=='200'){
var json = Ext.decode(conn.responseText);
var url = json.data;
Ext.getCmp('infos-view').getEl().unmask();
}else{
}
跳转方式(2)
Ext.getCmp('当前面板id').getEl().mask('Waiting...','x-mask-loading');
Ext.Ajax.timeout = 9000000000;
Ext.Ajax.request({
method : 'post',
url : '/PowerMS/getMonitorFile.do',
params : {'cuid':cuid},
success : function(response){
var json = Ext.decode(response.responseText);
Ext.getCmp('当前面板id').getEl().unmask();
},
failure : function(){
var json = Ext.decode(response.responseText);
}
})
跳转方式(3)(form提交方式)
this.form.doAction('submit',{
url : url,
method : 'post',
params : {},
timeout : 100000000,
waitMsg : 'Waiting...',//进度条消息
success : function(form,action){
var tip = action.result.data; //data为Action对应的键
},
failure : function(){
},
});
//---------------store读值.....为combo、grid等赋值
var ds = new Ext.data.JsonStore({
url : '/PowerMS/initComp.do',
root : 'root',
fields : [{name:'id'},{name:'dictName'}],
baseParams : {'query' : 115000} //往后台传值
});
ds.baseParams = {'treeId':_node.id};//往后台传值
ds.load({params:{'start':0,'limit':15}});
//--------------后台取值加载树
var root = new Ext.tree.AsyncTreeNode({
id : ''
text : '',
loader : new Ext.tree.TreeLoader({dataUrl : '地址'})
});
//---------------进度条控制
//显示进度条
Ext.getCmp('当前面板id').getEl().mask('Waiting...','x-mask-loading');
//关闭进度条
Ext.getCmp('当前面板id').getEl().unmask();