Skip to content
Snippets Groups Projects
Commit da2b159f authored by juanf's avatar juanf
Browse files

BIS-659 / SP-1195 : ELN UI : Sort Samples table by column contents clicking on the header

SVN: 31156
parent 769a9501
No related branches found
No related tags found
No related merge requests found
...@@ -230,6 +230,34 @@ h1, h2, legend { ...@@ -230,6 +230,34 @@ h1, h2, legend {
margin: 10px; margin: 10px;
} }
/* Sorting */
.interactive th:hover {
cursor: pointer;
background-color: #F5F5F5;
}
.current-sort {
margin-right: 20px;
background-color: lightblue;
background-size:14px 14px;
background-repeat:no-repeat;
background-position: right center;
border-right: 5px solid lightblue;
}
.interactive th.current-sort:hover {
background-color: lightblue;
}
.current-sort[sort-order = DS] {
background-image: url("../img/chevron-down-icon.png");
}
.current-sort[sort-order = AS] {
background-image: url("../img/chevron-up-icon.png");
}
/* /*
* Sample Table - Inspector Previews * Sample Table - Inspector Previews
*/ */
......
...@@ -205,7 +205,7 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe ...@@ -205,7 +205,7 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe
$("#tableContainer").append("<div class='wrapper' style='clear: both; padding-top: 10px;'>"); $("#tableContainer").append("<div class='wrapper' style='clear: both; padding-top: 10px;'>");
var tableTemplate = "<table style='width:100%;' class='table table-hover' id=\"sample-table\"><thead>"; var tableTemplate = "<table style='width:100%;' class='table table-hover' id=\"sample-table\"><thead>";
tableTemplate += "<tr class=\"sample-table-header\"><th sort-attribute='code'>Code</th>"; tableTemplate += "<tr class=\"sample-table-header interactive\"><th sort-attribute='code'>Code</th>";
for (var i = 0; i < sampleTypePropertiesDisplayNames.length; i++) { for (var i = 0; i < sampleTypePropertiesDisplayNames.length; i++) {
tableTemplate += "<th sort-property='" + sampleTypeProperties[i] + "'>" + sampleTypePropertiesDisplayNames[i]+ "</th>"; tableTemplate += "<th sort-property='" + sampleTypeProperties[i] + "'>" + sampleTypePropertiesDisplayNames[i]+ "</th>";
} }
...@@ -253,6 +253,8 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe ...@@ -253,6 +253,8 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe
} }
var sortingFunction = function(event) { var sortingFunction = function(event) {
$(".sample-table-header th").removeClass("current-sort")
var $th = $(this); var $th = $(this);
var sortProperty = $th.attr("sort-property"); var sortProperty = $th.attr("sort-property");
var sortAttribute = $th.attr("sort-attribute"); var sortAttribute = $th.attr("sort-attribute");
...@@ -272,6 +274,8 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe ...@@ -272,6 +274,8 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe
if(sortAttribute) { if(sortAttribute) {
sortByAttribute(sortAttribute,sortOrder === "AS"); sortByAttribute(sortAttribute,sortOrder === "AS");
} }
$th.addClass("current-sort");
} }
var $headers = $(".sample-table-header th").click(sortingFunction); var $headers = $(".sample-table-header th").click(sortingFunction);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment