PDA

View Full Version : need help on message boxes in a function



knappy
1 May 2010, 8:48 AM
I have a function run when a link is clicked in a grid. The function worked fine until i added two ux items. Since I'm sure the ux.grid.Search and the ux.MediaWindow is probably fine, I am guessing i have something messed up. I used the examples from the message box demo to show a wait message, start an ajax call and then based on the response, showan alert or change the window location. It stopped working and started throwing the error: "a.getItemId is not a function"

Here is the function. I have it outside of the onReady but am completely stumped. I have narrowed it down tothe message boxes.... meaning if I comment those lines out, it works.
Any thoughts on a glaring mistake?



function gwnld(id,vidt,act,h){
var action;
var linkd;
var msgb;
Ext.MessageBox.show({
msg: 'Starting your download...',
progressText: 'Saving...',
title:'Download',
width:300,
wait:true,
waitConfig: {interval:200},
icon:'ext-mb-download'
});
Ext.Ajax.request({
url: 'myurl.php',
success: function(result, request){
var jsonData = Ext.util.JSON.decode(result.responseText);
switch(jsonData.action){
case 'max':
Ext.Msg.alert('Download Error','my error message');
break;
case 'rate':
Ext.Msg.alert('Rating Alert','rate message');
break;
case 'redir':
Ext.Msg.alert('Download Error','An unhandled exception has occured. An email has been generated to the site admin.');
break;
case 'down':
window.location.assign(jsonData.link);
Ext.MessageBox.hide();
break;
default:
Ext.Msg.alert('Download Error','An unhandled exception has occured. An email has been generated to the site admin.');
}

},
failure: function(){
Ext.Msg.alert('Download Error','An unhandled exception has occured. An email has been generated to the site admin.');
Ext.MessageBox.hide();
}
});

}