=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/lists.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/lists.js 2009-12-03 07:32:07 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/lists.js 2010-03-12 11:15:04 +0000 @@ -284,6 +284,21 @@ } /** + * Creates a hidden select list used for temporarily storing + * options for filtering + * + * TODO: avoid performance hit on page with many selects, by checking use of filterList method + */ +$(document).ready(function() { + $("select").each(function(i,o){ + var m = document.createElement("select"); + m.id = o.id+"_storage"; + m.style.visibility="hidden"; + document.body.appendChild(m); + }); +}); + +/** * Filters out options in a select list that don't match the filter string by * hiding them. * @@ -291,18 +306,26 @@ * @param listId the id of the list to filter. */ function filterList( filter, listId ) { - var list = document.getElementById( listId ); - - for ( var i=0; i $(b).text() ? 1: -1; + }); + $("#"+listId).empty().html(sortedVals); + $("#"+listId).val('--'); + + /* For FF only - no performance issues + $("#" + listId).find('option').hide(); + $("#" + listId).find('option:Contains("' + filter + '")').show();*/ } /**