1

I am using struts2 autocompleter. When I click on the dropdown icon it gives all results. I have tried setting maxlength & size attributes but it doesnt work. Is there a way to limit the maximum number of values?? Or maybe add a scroll bar?? This is my autocompleter code :

 <s:url id="myURL" action="AutoComplete"/>    
 <sj:select 
 id="autooo"  
 name="echo" selectBoxIcon="true"
 label="Handle a List"
 href="%{myURL}" 
 list="govAdvCaseList" 
 listValue="case_No" 
 listKey="case_id" maxlength="5" 
 autocomplete="true"  size="5"
 loadMinimumCount="4" 
 />

Thanks In Advance :)

Roman C
  • 49,761
  • 33
  • 66
  • 176
Pradnya
  • 649
  • 2
  • 6
  • 17
  • possible duplicate of [Limit results in jQuery UI Autocomplete](http://stackoverflow.com/questions/7617373/limit-results-in-jquery-ui-autocomplete) – Aleksandr M Oct 09 '14 at 11:28
  • this is *good* question, struts2-jquery plugin should handle viewable area of the widget. – Roman C Oct 09 '14 at 11:34

1 Answers1

1

I got the answer here

Applying this css worked for me. It created a scroll bar if not limiting the values

   <style>
  .ui-autocomplete {
    max-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
  }
   .ui-autocomplete {
    height: 100px;
  }
  </style>


<div class="ui-widget">
  auto completer here
</div>
Roman C
  • 49,761
  • 33
  • 66
  • 176
Pradnya
  • 649
  • 2
  • 6
  • 17