Skip to content

Commit cddf8eb

Browse files
authored
Merge pull request #1535 from ImagingDataCommons/release-50-sp
Table sizing bugfix
2 parents 0502120 + c52e77e commit cddf8eb

2 files changed

Lines changed: 14 additions & 18 deletions

File tree

static/js/tables.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
8282
});
8383
$('#proj_table, #cases_tab, #studies_tab, #series_tab, #cart-table').on('draw.dt', function(){
8484
window.hide_spinner();
85+
// Auto-width needing to be shut off at the table header level during draw time.
86+
$(this).children('th').each(function() {
87+
this.style.width = null;
88+
});
8589
});
8690

8791
// Update the rows in the Projects Table, clear the other tables.
@@ -456,7 +460,6 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
456460
});
457461
}
458462

459-
460463
window.getProjectCartStats = function(projidArr){
461464
var parsedFiltObj = filterutils.parseFilterObj();
462465
parsedFiltObj.collection_id = projidArr;
@@ -756,13 +759,13 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
756759
updatePromise.reject();
757760
}
758761

759-
$('#cases_tab').on('draw.dt', function(){
760-
$('#cases_table_head').children('tr').children().each(function(){
761-
this.style.width=null;
762-
}
763-
);
762+
// Remove autowidthing from the table header, which is reapplied any time it's created
763+
$('#cases_table_head').children('tr').children().each(function(){
764+
this.style.width=null;
764765
});
766+
765767
$('#cases_tab').find('tbody').attr('id','cases_table');
768+
766769
$('#cases_panel').find('.dataTables_controls').find('.dataTables_length').after(
767770
'<div class="dataTables_goto_page"><label>Page </label><input class="goto-page-number" '
768771
+ 'type="number"><button onclick="changePage(\'cases_tab_wrapper\')">Go</button></div>'
@@ -1129,12 +1132,9 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
11291132
updatePromise.reject();
11301133
}
11311134

1132-
$('#studies_tab').on('draw.dt', function(){
1133-
$('#studies_table_head').children('tr').children().each(function(){
1134-
this.style.width=null;
1135-
}
1136-
);
1137-
})
1135+
$('#studies_table_head').children('tr').children().each(function(){
1136+
this.style.width=null;
1137+
});
11381138

11391139
$('#studies_tab').children('tbody').attr('id','studies_table');
11401140
$('#studies_tab_wrapper').find('.dataTables_controls').find('.dataTables_length').after(
@@ -1496,10 +1496,8 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
14961496
updatePromise.reject();
14971497
}
14981498

1499-
$('#series_tab').on('draw.dt', function(){
1500-
$('#series_table_head').children('tr').children().each(function(){
1501-
this.style.width=null;
1502-
});
1499+
$('#series_table_head').children('tr').children().each(function(){
1500+
this.style.width=null;
15031501
});
15041502
$('#series_tab').children('tbody').attr('id','series_table');
15051503
$('#series_tab_wrapper').find('.dataTables_controls').find('.dataTables_length').after(

templates/idc/explore_data_core.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ <h4 class="panel-title">
897897

898898
</div>
899899
<div id="projects_panel" class="panel-body">
900-
901900
<table id="proj_table" class="table table-striped projects-table" data-table-type="collection">
902901
<thead id="projects_table_head">
903902
<tr>
@@ -921,7 +920,6 @@ <h4 class="panel-title">
921920
<div id="cases_panel_container" class="panel panel-default">
922921
<div class="panel-heading clearfix"><h4 class="panel-title">Selected Cases</h4></div>
923922
<div id="cases_panel" class="panel-body">
924-
925923
<table id="cases_tab" class="table table-striped cases-table" data-table-type="case">
926924
<thead id="cases_table_head">
927925
<tr>

0 commit comments

Comments
 (0)