From d2b5da422f91bb624fe073e30f62e2948a5c2b64 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Tue, 10 Jun 2014 08:38:53 +0000 Subject: [PATCH] SSDM-312: Possibility to choose which columns to show /print. SVN: 31694 --- .../html/js/widgets/DilutionWidget.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js index 8df9ac3cbda..3dc92442b33 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js @@ -398,6 +398,7 @@ function DilutionWidget(containerId, serverFacade, isEnabled) { } ); $legend.append($printButton); + //Defining containers var $wrapper = $("<div>"); $wrapper.append($legend); @@ -497,5 +498,31 @@ function DilutionWidget(containerId, serverFacade, isEnabled) { // $wrapper.append(); $("#"+this._containerId).append($wrapper); + + // + // Add Show / Hide Columns Filter + // + var $filterColumsToShow = $('<select>', { 'id' : 'filterColumsToPrint' , class : 'multiselect' , 'multiple' : 'multiple'}); + var columns = $tableHeadTr.children(); + for(var i = 0; i < columns.length; i++) { + $filterColumsToShow.append($('<option>', { 'value' : i , 'selected' : ''}).text(columns[i].textContent)); + } + $filterColumsToShow.change(function(event){ + var columnsToShow = $(this).val(); + var hardCodedNumberOfColumns = 9; //TO-DO Fix this to get it from DOM + for(var i = 0; i < hardCodedNumberOfColumns; i++) { + var $column = $('#dillution-widget-table td:nth-child(' + (i + 1) + '), #dillution-widget-table th:nth-child(' + (i + 1) + ')'); + if($.inArray("" + i, columnsToShow) !== -1) { + $column.show(); + } else { + $column.hide(); + } + + } + }); + + $legend.append(" "); + $legend.append($filterColumsToShow); + $('#filterColumsToPrint').multiselect(); } } \ No newline at end of file -- GitLab