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
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to