giovannotti
3 Jun 2009, 1:15 PM
hi all, I have a problem with a file upload.
upload this file invokes the corresponding action, for processing and then populate a grid with the information that was read.
the problem is that when the action will open a window indicating that you download will download, for example, readFileAction.action and therefore does not fill the grid.
I am wrong in how I'm doing?
var fileUploadPanel = new Ext.FormPanel({
renderTo: 'fi-form',
fileUpload: true,
width: 200,
frame: false,
border : 0,
labelWidth: 142,
margins: '0 0 0 0',
cmargins: '0 0 0 0',
bodyStyle:'padding:5px 15px 5px 10px',
tooltip : 'Load items from a text file',
items: [
{
xtype: 'fileuploadfield',
id: 'form-file',
name: 'filePath',
buttonOnly : true,
fieldLabel: 'Load file ...',
//emptyText: 'Seleccione',
//width: 5,
buttonCfg: {
text: '',
iconCls: 'x-btn-addGrid-blue'
},
listeners: {
'fileselected' : function(fb, v) {
var preg = "Are you sure?";
Ext.MessageBox.confirm('Confirm', preg, function(btn) {
var resp = "" + btn;
if ( resp == "yes") {
var url = "";
url = _ACTION_UPLOAD_FILE;
if ( fileUploadPanel.getForm().isValid() ) {
fileUploadPanel.getForm().submit({
url: url,
waitMsg: 'Wait...',
success: function(fp, o){
alert('File "'+o.result.file+'" on server');
},
failure: function (){
alert("Fail");
}
});
}
}
});
}
}
}
]
});
upload this file invokes the corresponding action, for processing and then populate a grid with the information that was read.
the problem is that when the action will open a window indicating that you download will download, for example, readFileAction.action and therefore does not fill the grid.
I am wrong in how I'm doing?
var fileUploadPanel = new Ext.FormPanel({
renderTo: 'fi-form',
fileUpload: true,
width: 200,
frame: false,
border : 0,
labelWidth: 142,
margins: '0 0 0 0',
cmargins: '0 0 0 0',
bodyStyle:'padding:5px 15px 5px 10px',
tooltip : 'Load items from a text file',
items: [
{
xtype: 'fileuploadfield',
id: 'form-file',
name: 'filePath',
buttonOnly : true,
fieldLabel: 'Load file ...',
//emptyText: 'Seleccione',
//width: 5,
buttonCfg: {
text: '',
iconCls: 'x-btn-addGrid-blue'
},
listeners: {
'fileselected' : function(fb, v) {
var preg = "Are you sure?";
Ext.MessageBox.confirm('Confirm', preg, function(btn) {
var resp = "" + btn;
if ( resp == "yes") {
var url = "";
url = _ACTION_UPLOAD_FILE;
if ( fileUploadPanel.getForm().isValid() ) {
fileUploadPanel.getForm().submit({
url: url,
waitMsg: 'Wait...',
success: function(fp, o){
alert('File "'+o.result.file+'" on server');
},
failure: function (){
alert("Fail");
}
});
}
}
});
}
}
}
]
});