jQuery autocomplete non mostrerà più di 10 risultati
-
25-09-2019 - |
Domanda
Sto utilizzando il completamento automatico jQuery, e non importa quali impostazioni cambio, non posso farlo per mostrare più di 10 risultati in discesa. Posso vedere nei risultati di ritorno che sto ricevendo tutti loro dal server, ma il front-end, non mostrerò più di 10.
$("#add_cpt_code_text").autocomplete('<%: Url.Action("SearchCPT", "ChargeCapture") %>', {
autoFill: false,
mustMatch: true,
matchContains: true,
cacheLength: 1,
maxItemsToShow: 15,
minChars: 3,
extraParams: {
LocationID: 0
},
formatItem: function (data, index, max) {
return data[1];
},
formatMatch: function (data, index, max) {
return data[1];
},
formatResult: function (data, index, max) {
return data[1];
}
}).result(function (event, data, formatted) {
if (data) {
$("#add_cpt_code_id").val(data[0]);
$("#add_cpt_code_text").val(data[1]);
}
else {
$("#add_cpt_code_id").val('');
}
});
Soluzione
Ho trovato la risposta, ho bisogno di usare max, non maxItemsToShow
Stavo usando il jquery-ui completamento automatico
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow