From 577e526feca7cc9f50559cc55ed84bfa7f63251c Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Tue, 10 Jan 2017 16:31:20 +0100 Subject: [PATCH 1/2] 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) { From 3a3f20a215f3bdf2ac710f479864662cdaaa1f51 Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Wed, 11 Jan 2017 15:25:10 +0100 Subject: [PATCH 2/2] fix bug with different approach --- .../javascripts/samples/sample_datatable.js.erb | 12 ------------ app/assets/stylesheets/extend/bootstrap.scss | 5 +++++ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index e74d6ede9..4a00e6d91 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -108,7 +108,6 @@ function dataTableInit() { animateSpinner(this, false); changeToViewMode(); updateButtons(); - $('div.dataTables_scrollBody').height($('#samples').height()); }, preDrawCallback: function() { animateSpinner(this); @@ -463,17 +462,6 @@ function onClickEdit() { $("select[name=sample_type_id]").on('change', function(){ 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) { diff --git a/app/assets/stylesheets/extend/bootstrap.scss b/app/assets/stylesheets/extend/bootstrap.scss index 5c5000a7a..a553c995e 100644 --- a/app/assets/stylesheets/extend/bootstrap.scss +++ b/app/assets/stylesheets/extend/bootstrap.scss @@ -110,3 +110,8 @@ width: 100%; } } + +.dataTables_scrollBody { + height: auto !important; + overflow: visible !important; +}