PDA

View Full Version : How to set out of time under handler:function()



edwardking
6 Aug 2010, 6:55 AM
I want to use extjs3 to submit a struts action,this action will query Database,if the query time is very long,I think login action outoftime,so I want to set out of time in extjs, if out of time,I will alert('login out of time,please try latter"). But I don't know how to correct my code. Please help me. Thanks



var win=new Ext.Window({
el:'hello-win',
layout:'fit',
animateTarget:document.body,
items:
loginForm,
buttons:[{
text:'Login',
handler:function(){
if(win.getComponent('loginForm').form.isValid()){
win.getComponent('loginForm').form.submit({
url:'Test.do' (http://www.sencha.com/forum/'Test.do'),
waitTitle:'Login',
method: 'POST',
waitMsg:'Waiting.....',
......
success:function(form,action){
Ext.Msg.alert("Success?",action.result.message);
window.location.href='main.do';
},
failure:function(form,action){
Ext.Msg.alert('Fail',action.result.message);
refreshcode();
}
.....

Condor
6 Aug 2010, 11:55 PM
submit() allows for a timeout config option (in secs). If the action times out you get a failure callback with action.response.isTimeout set to true.

edwardking
8 Aug 2010, 5:24 PM
submit() allows for a timeout config option (in secs). If the action times out you get a failure callback with action.response.isTimeout set to true.

How to write the code "action.response.isTimeout"?