Select2 dropdown does not find and data. If I click in the text area or enter chars to search. It always says “No match found”
scripts1.js
$("#getDevs").select2({
//placeholder: “Enter Devices for Maintenance”,
multiple: true,
allowClear: true,
ajax: {
url: ‘data/devices.json’,
dataType: ‘json’,
delay: 750,
data: function (query) {
//console.log(query)
return { search: query.term };
},
processResults: function (data,query) {
// parse the results into the format expected by Select2
console.log(data)
return {
//results: JSON.parse(data),
results: data
};
}
}
})
HTML
</div>
<input id="getDevs" style="width:50%;" placeholder="Enter text and scroll for more results" />
</div>
I have the data loaded here is the console log:
-
{results: Array(21956), pagination: {…}}
-
pagination: {more: true}
-
results: (21956) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, …]
-
proto: Object
This does show all my devices.