Commit 77f48179 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix select zone by form for mixes

parent 7e1536b9
......@@ -48,9 +48,10 @@ dgenies.reset_loading_message = function () {
dgenies.fill_select_zones = function(x_targets, y_contigs) {
let select_contig = $("select#select-contig");
select_contig.find("option[value!=0]").remove();
select_contig.find("option[value!='###NONE###']").remove();
for (let i=0; i< y_contigs.length; i++) {
let label = y_contigs[i];
let value = label;
if (label.startsWith("###MIX###")) {
let parts = label.substr(10).split("###");
label = "Mix: " + parts.slice(0, 3).join(", ");
......@@ -59,16 +60,17 @@ dgenies.fill_select_zones = function(x_targets, y_contigs) {
}
}
select_contig.append($('<option>', {
value: i+1,
value: value,
text: label
}))
}
select_contig.chosen({disable_search_threshold: 10, search_contains: true});
select_contig.trigger("chosen:updated");
let select_target = $("select#select-target");
select_target.find("option[value!=0]").remove();
select_target.find("option[value!='###NONE###']").remove();
for (let i=0; i< x_targets.length; i++) {
let label = x_targets[i];
let value = label;
if (label.startsWith("###MIX###")) {
let parts = label.substr(10).split("###");
label = "Mix: " + parts.slice(0, 3).join(", ");
......@@ -77,7 +79,7 @@ dgenies.fill_select_zones = function(x_targets, y_contigs) {
}
}
select_target.append($('<option>', {
value: i+1,
value: value,
text: label
}))
}
......
......@@ -36,8 +36,8 @@ dgenies.result.controls.launch_sort_contigs = function () {
dgenies.result.controls.select_zone = function() {
let contig_select = $("#select-contig").find(":selected");
let target_select = $("#select-target").find(":selected");
if (parseInt(contig_select.val()) > 0 && parseInt(target_select.val())) {
d3.boxplot.select_zone(null, null, target_select.text(), contig_select.text(), true);
if (contig_select.val() !== "###NONE###" && target_select.val() !== "###NONE###") {
d3.boxplot.select_zone(null, null, target_select.val(), contig_select.val(), true);
}
else {
dgenies.notify("Please select zones into zoom!", "danger", 2000);
......
......@@ -23,12 +23,12 @@
<form id="select-zone">
<div class="chosen-widget">
<select id="select-target" data-placeholder="Select a target...">
<option value="0" label=" "></option>
<option value="###NONE###" label=" "></option>
</select>
</div>
<div class="chosen-widget">
<select id="select-contig" data-placeholder="Select a query...">
<option value="0" label=" "></option>
<option value="###NONE###" label=" "></option>
</select>
</div>
<input type="button" class="submit" value="Apply"/>
......
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