3

I have searched enough, but am not able to find the solution to this. Could you please help me out.

I have a table which has around 700 records, and I want the autocomplete to display not more than 5 records in the result. It should have a scroll bar.

John Palmer
  • 25,356
  • 3
  • 48
  • 67
Deepak B M
  • 43
  • 2
  • 6

1 Answers1

4

Unfortunetely there is no bulit in property to set max limit. You can use:

$("#autocmplt").autocomplete({
source: function(req, response) {
    var results = $.ui.autocomplete.filter(myarray, req.term);

    response(results.slice(0, 5));//for getting 5 results
   }
});

Working Demo

Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125