Skip to content

Commit

Permalink
Merge pull request #5254 from solgenomics/graphical_filtering_accessi…
Browse files Browse the repository at this point in the history
…on_list_fix

Fix bug in graphical filtering tool add to list
  • Loading branch information
afpowell authored Dec 19, 2024
2 parents 5f804d9 + 44cfecc commit 83e3aa3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/CXGN/BrAPI/v2/ObservationUnits.pm
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ sub _search {
## Format position coordinates
my $level_name = $obs_unit->{obsunit_type_name};

print STDERR "LEVEL NAME: ".Dumper(\%numbers);
# print STDERR "LEVEL NAME: ".Dumper(\%numbers);

my $level_order = _order($level_name) + 0;

Expand Down
37 changes: 26 additions & 11 deletions mason/tools/graphicalfiltering/index.mas
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,35 @@
});

$('#filtered_results').on( 'draw.dt', function () {
var table = $("#filtered_results").DataTable();
var accessionColumnIndex = -1;

var names = [];
var data = $("#filtered_results").DataTable().context[0].aoData;
var displayed_rows = $("#filtered_results").DataTable().context[0].aiDisplay;
var names = [];
for (var i =0; i< displayed_rows.length; i++){
var displayed_index = displayed_rows[i];
names.push(data[displayed_index]._aFilterData[2]+'\n');
// Determine the correct column index for "Accession"
table.columns().every(function (index) {
var header = this.header();
if ($(header).text().trim() === "Accession") {
accessionColumnIndex = index;
}
$('#graphical_filter_result_names').html(names);
addToListMenu('graphical_filter_results_to_list_menu', 'graphical_filter_result_names', {
listType: 'accessions'
});
});

if (accessionColumnIndex === -1) {
console.error("Accession column not found.");
return;
}

var names = [];
var displayed_rows = table.rows({ filter: 'applied' }).indexes();
displayed_rows.each(function (index) {
var accessionName = table.cell(index, accessionColumnIndex).data();
names.push(accessionName + '\n');
});

$('#graphical_filter_result_names').html(names.join(''));
addToListMenu('graphical_filter_results_to_list_menu', 'graphical_filter_result_names', {
listType: 'accessions'
});

});

}());

Expand Down

0 comments on commit 83e3aa3

Please sign in to comment.