=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java 2012-06-15 04:41:31 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java 2012-06-25 13:20:32 +0000 @@ -51,5 +51,5 @@ Collection getAllOptionSets(); - List getOptions( OptionSet optionSet, String key ); + List getOptions( OptionSet optionSet, String key, Integer max ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionStore.java 2012-06-24 09:35:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionStore.java 2012-06-25 13:20:32 +0000 @@ -38,5 +38,6 @@ */ public interface OptionStore extends GenericIdentifiableObjectStore { - List getOptions( OptionSet optionSet, String key, int max ); + List getOptions( OptionSet optionSet, String key, Integer max ); } + === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2012-06-24 09:35:28 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2012-06-25 13:20:32 +0000 @@ -81,8 +81,8 @@ return optionStore.getAll(); } - public List getOptions( OptionSet optionSet, String key ) + public List getOptions( OptionSet optionSet, String key, Integer max ) { - return optionStore.getOptions( optionSet, key, 100 ); + return optionStore.getOptions( optionSet, key, max ); } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java 2012-06-24 09:35:28 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java 2012-06-25 13:20:32 +0000 @@ -45,12 +45,17 @@ { @SuppressWarnings("unchecked") @Override - public List getOptions( OptionSet optionSet, String key, int max ) + public List getOptions( OptionSet optionSet, String key, Integer max ) { - String hql = "select option from OptionSet as optionset inner join optionset.options as option where optionset.id = :optionSetId and lower(option) like lower('%" + key + "%') "; - + String hql = "select option from OptionSet as optionset inner join optionset.options as option where optionset.id = :optionSetId "; + if( key != null ) + { + hql += " and lower(option) like lower('%" + key + "%') "; + } + Query query = getQuery( hql ); query.setInteger( "optionSetId", optionSet.getId() ); + query.setMaxResults( max ); return query.list(); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java 2012-06-20 06:32:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java 2012-06-25 13:20:32 +0000 @@ -43,6 +43,8 @@ public class GetOptionsByDataElementAction implements Action { + private static Integer MAX_OPTIONS_DISPLAYED = 10; + // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- @@ -98,8 +100,8 @@ { DataElement dataElement = dataElementService.getDataElement( id ); - options = optionService.getOptions( dataElement.getOptionSet(), query ); - + options = optionService.getOptions( dataElement.getOptionSet(), query, MAX_OPTIONS_DISPLAYED ); + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-06-23 11:05:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-06-25 13:20:32 +0000 @@ -814,6 +814,7 @@ { var input = jQuery( "#" + idField ) var dataElementId = input.attr('id').split('-')[1]; + input.autocomplete({ delay: 0, minLength: 0, @@ -831,7 +832,7 @@ } }); }, - minLength: 2, + minLength: 0, select: function( event, ui ) { input.val(ui.item.value); saveVal( dataElementId ); @@ -852,4 +853,25 @@ } }) .addClass( "ui-widget" ); + + var button = $( "" ) + .attr( "tabIndex", -1 ) + .attr( "title", i18n_show_all_items ) + .insertAfter( input ) + .button({ + icons: { + primary: "ui-icon-triangle-1-s" + }, + text: false + }) + .addClass( "small-button" ) + .click(function() { + if ( input.autocomplete( "widget" ).is( ":visible" ) ) { + input.autocomplete( "close" ); + return; + } + $( this ).blur(); + input.autocomplete( "search", "" ); + input.focus(); + }); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-06-25 03:19:12 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-06-25 13:20:32 +0000 @@ -167,8 +167,9 @@ height:20px; } -.optionset-small-button{ - font-size: .8em !important; +.ui-button{ + max-height: 100px; + max-height: 100px; } .ui-autocomplete {