PDA

View Full Version : Setting timeout in progress bar



anshu_gupta
21 Jan 2011, 12:43 AM
Hi,
I have a progress bar.

Ext.MessageBox.show( {
msg : please wait...',
progressText : Wait',
width : 300,
wait : true,
waitConfig : {
interval : 200
}
});
And i also have a AJax.Request after this. What i want is to execute the ajax request and to set timeout for the progress bar.
Currently, what happens is my ajax request takes around 3-5 min. I need to set timeout for the request.
I tried Ajax.timeout=50000;
but the request was termintaed after that. still progress bar was running indefinitely.
Thanks

valititi
21 Jan 2011, 5:49 AM
can you post the code of your Ajax call ?

valititi
22 Jan 2011, 10:55 AM
Ajax not msgbox code... anyway...

var boxWait=Ext.MessageBox.wait('message','title'); // first make a 'wait' stuff...
Ext.Ajax.request({
url:urlYourFile,
timeout: 50000, // this means 50 seconds, use this timeout and not messagebox timeout !
success: function(response,o) {
boxWait.hide();
var obj=Ext.decode(response.responseText);
if(obj.success){
}
else{
Ext.Msg.show({title:'ATitle', msg:obj.response, icon:Ext.Msg.ERROR, buttons:Ext.Msg.OK});
return
}
},
failure:function(response,o){
boxWait.hide();
var tx=response.status;
Ext.Msg.show({title:'Server-side call failed !', msg:response.status, icon:Ext.Msg.ERROR, buttons:Ext.Msg.OK});
return
}
});


may this help ?

anshu_gupta
8 Feb 2011, 12:22 AM
thanks. sorry for late reply.
Following is the code that i am trying but it works only when the response from server is within a given time. If response from server is not coming, the progress bar keeps stays as it is and doesnot go.
Code:

function onReSync() {
var waitDialog = Ext.MessageBox.show( {
msg : 'please wait...',
progressText : 'Re-Syncing...',
width : 300,
wait : true,
waitConfig : {
interval : 200
}
});
Ext.Ajax.request( {
url : Url,
method : 'GET',
timeout : 20000,
disableCaching : false,
waitMsg : 'processing',
success : function(res, a) {
waitDialog.hide();
var msg = Ext.util.JSON.decode(res.responseText).message;

Ext.Msg.alert('Information', 'Task completed successfully');


},
failure : function(res, a) {
waitDialog.hide();
var msg = Ext.util.JSON.decode(res.responseText).message;
Ext.Msg.alert('Error', msg);
discoveredDeviceGrid.getSelectionModel().clearSelections(true);
}
});

}