Skip to content
Snippets Groups Projects
Commit 778ae7de authored by anttil's avatar anttil
Browse files

LMS-2784 Filtering is now performed on every keypress. Filtering changed to case insensitive.

SVN: 24392
parent 6d47ffc8
No related branches found
No related tags found
No related merge requests found
...@@ -280,18 +280,26 @@ function displayReturnedSamples(data) ...@@ -280,18 +280,26 @@ function displayReturnedSamples(data)
} }
function plasmidFilter(filter, element, index, array) { function plasmidFilter(filter, element, index, array) {
// console.log("plasmidFilter called with filter "+filter);
filter = filter.toLowerCase();
if (element.code.toLowerCase().indexOf(filter) != -1) {
return true;
}
if (element.identifier.toLowerCase().indexOf(filter) != -1) {
return true;
}
for (var propertyName in element.properties) { for (var propertyName in element.properties) {
if (!(element.properties[propertyName] instanceof Function)) { if (!(element.properties[propertyName] instanceof Function)) {
if (element.properties[propertyName].indexOf(filter) != -1) { if (element.properties[propertyName].toLowerCase().indexOf(filter) != -1) {
return true; return true;
} }
} }
} }
return false; return false;
//return element.properties.PLASMID_NAME.indexOf(filter) != -1;
} }
function visualize(filterText) function visualize(filterText)
...@@ -326,6 +334,8 @@ function visualize(filterText) ...@@ -326,6 +334,8 @@ function visualize(filterText)
return "none" return "none"
} }
}); });
console.log(displayedPlasmids[0]);
} }
/** /**
...@@ -388,10 +398,11 @@ $(document).ready(function() { ...@@ -388,10 +398,11 @@ $(document).ready(function() {
openbisServer.login( $.trim($('#username').val()), $.trim($('#password').val()), function(data) { enterApp(data) }) openbisServer.login( $.trim($('#username').val()), $.trim($('#password').val()), function(data) { enterApp(data) })
}); });
$('#filter-form').submit(function() { $('#filter').keydown(function() {
visualize($('#filter').val()); visualize($('#filter').val());
}); });
openbisServer.ifRestoredSessionActive(function(data) { enterApp(data) }); openbisServer.ifRestoredSessionActive(function(data) { enterApp(data) });
// Make the ENTER key the default button // Make the ENTER key the default button
...@@ -421,19 +432,15 @@ $(document).ready(function() { ...@@ -421,19 +432,15 @@ $(document).ready(function() {
<div id="main"> <div id="main">
<div id="button-group"> <div id="button-group">
<button id="logout-button">Logout</button> Search:
<input id="filter" type="text">
<button id="logout-button" style="position: right">Logout</button>
</div> </div>
<div id="vis">
<form id="filter-form" action="javascript:">
<input id="filter" type="text">
<button class="filter-button" id="filter-button" type="submit">Filter</button>
</form>
<div id="vis">
<table id="plasmid-table" style="float: left"> <table id="plasmid-table" style="float: left">
<tr class="plasmid-table-header"><th>Code</th><th>Name</th><th>Owner</th></tr> <tr class="plasmid-table-header"><th>Code</th><th>Name</th><th>Owner</th></tr>
</table> </table>
<span id="inspectorsContainer"></span> <span id="inspectorsContainer"></span>
</div> </div>
</div> </div>
......
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