[Users] Uploading an Excel File using GeoExt

Smaran Harihar smaran.harihar at gmail.com
Mon Oct 1 22:20:34 CEST 2012


Hi,

I am new to ExtJS. Can someone guide me on how I should proceed if I wish
to upload a excel using button in the Toolbar.

This is a code that I got from searching but it is not working,

action = new Ext.Action({
    text: "Upload Excel",
    handler: function () {
        alert("This will help upload the 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);

-- 
Thanks & Regards
Smaran Harihar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20121001/cc95caa0/attachment.htm 


More information about the Users mailing list