Skip to content

Instantly share code, notes, and snippets.

@veriojon
Created November 9, 2010 19:23
Show Gist options
  • Save veriojon/669633 to your computer and use it in GitHub Desktop.
Save veriojon/669633 to your computer and use it in GitHub Desktop.
function exportAll() {
if (getFormIdFromStore()) {
window.open('/image_set/' + get_asset_set_id() + '/assets.xls?form_id=' + getFormIdFromStore(), 'Excel Download', 'width=300, height=200');
} else {
window.open('/image_set/' + get_asset_set_id() + '/assets.xls', 'Excel Download', 'width=300, height=200');
}
}
var fp = new Ext.FormPanel({
fileUpload: true,
frame: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [
{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Select an Excel file',
fieldLabel: 'File',
name: 'data_file',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
}
],
buttons: [
{
text: 'Import',
handler: function() {
if (fp.getForm().isValid()) {
fp.getForm().submit({
url: '/image_set/' + get_asset_set_id() + '/assets.xls',
waitMsg: 'Importing your excel file...',
success: function(fp, o) {
uploadExcel.hide();
msg('Success', 'Import complete');
imageStore.load();
},
failure: function() {
msg('Error', 'Your import did not complete successfully.');
}
});
}
}
},
{
text: 'Wipeout',
handler: function() {
fp.getForm().reset();
}
}
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment