Commit a0fe2e75 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

change the fill function to include format

parent 87846ed6
......@@ -861,7 +861,10 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
setClickServerBrowser(params);
$(".selectMultipleFiles").click(function() {
var paired = $(this).attr("paired_columns").split(",");
var p_cols = $(this).attr("paired_columns");
var cap = p_cols.match(/(.+)\[(.+)]/)
var format = cap[1];
var paired = cap[2].split(",");
var input = $(this).attr("for");
for (var np=0; np < paired.length; np++) {
paired[np] = input + "___" + paired[np].replace("_","-");
......@@ -869,7 +872,7 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
var fill_files = function(files) {
var paired_files = {};
var single_files = [];
var paired_regex = /(.+)(1|2).fastq(.gz)?/;
var paired_regex = RegExp("(.+)(1|2)." + format);
for (var f=0; f<files.length; f++) {
var file = files[f];
var match;
......@@ -878,13 +881,13 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
var nb = parseInt(match[2]);
if (!(base_name in paired_files)) {
paired_files[base_name] = [];
};
}
paired_files[base_name][nb-1] = file;
}
else {
single_files.push(file);
};
};
}
}
var data = [];
for (var group in paired_files) {
var line = {};
......@@ -896,10 +899,10 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
}
else {
line[paired[i]] ="";
};
};
}
}
data.push(line);
};
}
for (var j=0; j<single_files.length; j++) {
var data_line = {};
data_line[paired[0]] = single_files[j];
......@@ -907,7 +910,7 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
data_line[paired[k]] = "";
}
data.push(data_line);
};
}
var handsontable_obj = $("#handsontable_" + input);
var original_data=handsontable_obj.handsontable("getData");
handsontable_obj.handsontable("loadData", original_data.slice(0, original_data.length-1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment