I have a select2 dropdown box using remote datasource.
What I would like to do is if/when there is only one option returned by the search, auto select it. ie, the user doesn;t have to click on the option to make the selection.
$("#searchInfo_Entity_Key").select2({
ajax: {
    url: "/Adjustment/GetEntity",
    dataType: 'json',
    delay: 250,
    data: function (params) {
        return {
            term: params.term, // search term      
        };
    },
    processResults: function (data) {
        return {
            results: data
        };
    },
    results: function (data) {
        return { results: data };
    },
},
initSelection: function (element, callback) {
    var data = [];
    callback(data);
},
minimumInputLength: 2,
allowClear: true,
placeholder: "Select an entity"
});
 
    