From 577e526feca7cc9f50559cc55ed84bfa7f63251c Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Tue, 10 Jan 2017 16:31:20 +0100 Subject: [PATCH] adjust samples tables height when in edit mode selecting sample type or group --- .../javascripts/samples/sample_datatable.js.erb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index 3b5f7b940..fa044430e 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -90,6 +90,7 @@ function dataTableInit() { animateSpinner(this, false); changeToViewMode(); updateButtons(); + $('div.dataTables_scrollBody').height($('#samples').height()); }, preDrawCallback: function() { animateSpinner(this); @@ -440,6 +441,17 @@ function onClickEdit() { // Adjust columns width in table header table.columns.adjust(); + + // Adjust tables height when selecting sample type or group + $('.btn-group.bootstrap-select.show-tick').on('shown.bs.dropdown', function () { + var dropdown_height = $('.dropdown-menu.open').height(); + var table_body = $('div.dataTables_scrollBody'); + table_body.height(table_body.height()+dropdown_height+6); + }) + .on('hidden.bs.dropdown', function(){ + $('div.dataTables_scrollBody').height($('#samples').height()); + }); + $('div.dataTables_scrollBody').height($('#samples').height()); }, error: function (e, data, status, xhr) { if (e.status == 403) {