Created
November 9, 2010 19:19
-
-
Save veriojon/669630 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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