From 778ae7defb8d2ff0c2d2b4543ef9f06f998546b4 Mon Sep 17 00:00:00 2001 From: anttil <anttil> Date: Thu, 9 Feb 2012 08:46:21 +0000 Subject: [PATCH] LMS-2784 Filtering is now performed on every keypress. Filtering changed to case insensitive. SVN: 24392 --- .../html/yeastlabbrowser/plasmid-browser.html | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/plasmid/source/html/yeastlabbrowser/plasmid-browser.html b/plasmid/source/html/yeastlabbrowser/plasmid-browser.html index 0b86f748846..50558a20d38 100644 --- a/plasmid/source/html/yeastlabbrowser/plasmid-browser.html +++ b/plasmid/source/html/yeastlabbrowser/plasmid-browser.html @@ -280,18 +280,26 @@ function displayReturnedSamples(data) } 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) { if (!(element.properties[propertyName] instanceof Function)) { - if (element.properties[propertyName].indexOf(filter) != -1) { + if (element.properties[propertyName].toLowerCase().indexOf(filter) != -1) { return true; } } } return false; - //return element.properties.PLASMID_NAME.indexOf(filter) != -1; } function visualize(filterText) @@ -326,6 +334,8 @@ function visualize(filterText) return "none" } }); + + console.log(displayedPlasmids[0]); } /** @@ -388,10 +398,11 @@ $(document).ready(function() { openbisServer.login( $.trim($('#username').val()), $.trim($('#password').val()), function(data) { enterApp(data) }) }); - $('#filter-form').submit(function() { + $('#filter').keydown(function() { visualize($('#filter').val()); }); + openbisServer.ifRestoredSessionActive(function(data) { enterApp(data) }); // Make the ENTER key the default button @@ -421,19 +432,15 @@ $(document).ready(function() { <div id="main"> <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 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"> <tr class="plasmid-table-header"><th>Code</th><th>Name</th><th>Owner</th></tr> </table> - <span id="inspectorsContainer"></span> </div> </div> -- GitLab