jquery-tokeninput icon indicating copy to clipboard operation
jquery-tokeninput copied to clipboard

Issue #450 showing all results on focus without having to enter any query

Open michal-lipski opened this issue 12 years ago • 5 comments

This applies to situation when settings.minChars is set to 0

michal-lipski avatar Jan 09 '13 07:01 michal-lipski

Example of how to enable this when initializing the plugin?

quadrant6 avatar Jan 09 '13 23:01 quadrant6

just set minChars to 0

michal-lipski avatar Jan 10 '13 19:01 michal-lipski

Tried that but nothing happens on click - I have to enter at least one char. No error is returned.

My code:

$("input.types").tokenInput("types.php",{
                method: "POST",
                queryParam: "term",
                noResultsText: "No Results.",
                minChars: 0,
                showing_all_results: true,
                deleteText: "<i class='ss-icon ss-delete'></i>",
                hintText: 'Enter keyword',
                prePopulate: <?php echo $types ?>
            });

Tested in Safari and Chrome on mac.

quadrant6 avatar Jan 10 '13 23:01 quadrant6

What if you bind an event handler to the focus event where you manually trigger the keypress event. Or keyup, or keydown. Whatever prompts the search to execute. On Jan 10, 2013 6:01 PM, "quadrant6" [email protected] wrote:

Tried that but nothing happens - I have to enter at least one char. No error is returned.

My code:

$("input.types").tokenInput("types.php",{ method: "POST", queryParam: "term", noResultsText: "No Results.", minChars: 0, showing_all_results: true, deleteText: "", hintText: 'Type a category name', prePopulate: });

— Reply to this email directly or view it on GitHubhttps://github.com/loopj/jquery-tokeninput/pull/452#issuecomment-12123500.

kaheidt avatar Jan 10 '13 23:01 kaheidt

line #738 needed to be changed as well for it to work:

from: if(query && query.length) {

to: if((query && query.length) || (query == "" && showing_all_results())) {

matthewatdf avatar Jan 12 '13 01:01 matthewatdf