How Can I Pass A File List To A Bootbox Callback?
When my user try to upload several files, I trigger a bootbox modal to make him decide on 2 possible options. On the bootbox callback, I want to iterate over a list of file that I
Solution 1:
May your files
variable be altered "later on" in the scope of your loadFiles
function? If so, you should move the alteration part after using it for your dialog:
this.loadFiles = function(files){
if (files.length>1){ //here, 'files' is populated
bootbox.dialog({
message: APi18n.__("media_warning_multiple_file_input_modal_message"),
title: TAPi18n.__("media_warning_multiple_file_input_modal_header"),
animate: true,
buttons: {
danger: {
label: TAPi18n.__('cancel'),
className: "btn-default",
},
success: {
label: TAPi18n.__('media_warning_multiple_file_input_modal_ok_button'),
className: "btn-info",
callback: function() {
_.each(currFiles, function(file){
//etc.
});
// <--- HERE
}
Post a Comment for "How Can I Pass A File List To A Bootbox Callback?"