Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82823

AutoComplete openOnFocus new option

$
0
0

I'm using the datatable editor autoComplete field type plugin. Often times, I want to have the autocomplete open as soon as I focus. I updated the 'create' function to look for a new option called 'openOnFocus' in the plugin located here https://editor.datatables.net/plug-ins/field-type/editor.autoComplete to look like this:

create: function ( conf ) {
    conf._input = $('<input type="text" id="'+conf.id+'">')
        .autocomplete( conf.opts || {} );

    //Jquery UI default minlength
    var defaultOptsMinLength = 1;

    // Decide if a min length was passed in. If not, use default.
    var minLength = conf.opts && conf.opts.minLength;
    if (minLength == null) {
        minLength = defaultOptsMinLength;
    }

    if (conf.openOnFocus && conf._input.val().length >= minLength) {

        // Search and display results as soon as focus is detected on input
        conf._input.focus(function () {
            $(this).data("uiAutocomplete").search($(this).val());
        });
    }

    return conf._input[0];
},

Would this be something we could get added to the plugin? How do we request changes to the code? Is that a thing datatables is open to? I'm not sure where else to post this change request.

Thanks!


Viewing all articles
Browse latest Browse all 82823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>