I need to filter by more than one field, I can currently filter only by "name" but I also need to be able to filter by "code", I have not found in the documentation how to do this, I have tried to add more than one "getValue" but I can not find the right way to do this thanks
I tried to replace getValue with this without results:
getValue: function(element) {
return $(element).find("name").text() + " " + $(element).find("code").text();
}
getValue: function(element) {
return element["code"]["name"];
},
var options = {
data: [{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Aland Islands",
"code": "AX"
},
{
"name": "Albania",
"code": "AL"
},
{
"name": "Algeria",
"code": "DZ"
},
{
"name": "American Samoa",
"code": "AS"
},
],
getValue: "name",
list: {
match: {
enabled: true
}
}
};
$("#provider-json").easyAutocomplete(options);
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/easy-autocomplete/1.3.5/easy-autocomplete.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/easy-autocomplete/1.3.5/easy-autocomplete.themes.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/easy-autocomplete/1.3.5/jquery.easy-autocomplete.min.js"></script>
<input id="provider-json" />