PDA

View Full Version : Unable to Upload CSV File using GeoExt Action



Sam007
24 Sep 2012, 10:47 AM
Hi,


I am trying to create a CSV File upload on GeoExt Map App.


I need to place the upload function within the Ext.Action, so that I can add it to the toolbar of the GeoExt Panel. I am trying to implement this example (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.File). Here is my code,



action = new Ext.Action({
text: "Upload Excel",
control: new Ext.create('Ext.form.Panel', {
title: 'Upload a CSV File',
width: 400,
bodyPadding: 10,
frame: true,
renderTo: Ext.getBody(),
items: [{
xtype: 'filefield',
name: 'csv',
fieldLabel: 'CSV Upload',
labelWidth: 50,
msgTarget: 'side',
allowBlank: false,
buttonText: 'Select CSV File'
}],

buttons: [{
text: 'Upload',
handler : function() {
var form = this.up('form').getForm();
if(form.isValid()){
form.submit({
url: 'file-upload.py',
waitMsg: 'Uploading the CSV File...',
success: function(fp, o) {
Ext.Msg.alert('Success', 'Your csv file "' + o.result.file + '" has been uploaded.');
}
});
}
}
}]
}),
map: map,
// button options
tooltip: "Upload CSV File",
// check item options
group: "newTool"
});
actions["upCSV"] = action;
toolbarItems.push(action);


Firebug keeps giving me this error,



TypeError: b[d.xtype || e] is not a constructor


Am I declaring the function incorrectly within the Ext.Action?

mitchellsimoens
26 Sep 2012, 7:19 AM
Did you require all the classes being used here?

Sam007
26 Sep 2012, 7:34 AM
Only need to add CSV Upload function and a button that opens a browse window. This buton needs to be added to the toolbar. That's it.

Sam007
8 Oct 2012, 10:11 AM
Any update on this question?