struts-community-plugins / struts2-jquery

Struts2 jQuery Plugin
Apache License 2.0
83 stars 49 forks source link

Autocompleter ignores LoadMinimumCount #319

Closed B34v0n closed 1 year ago

B34v0n commented 1 year ago

The way I understand the "loadMinimumCount" Attribute for the Autocompleter is, that it doesn't load the autocompletion until the number of characters in the attribute is reached. That's how it worked in Version 4.0.3. I tested it with the "struts2-jquery-showcase". Click on Widgets, Autocompleter, AutocompleterJSON. (Because there, the "loadMinimumCount" is set to 2. In the new Version on the Website (Version 5.0.1) http://struts.jgeppert.com/struts2-jquery-showcase/index.action it immediatly shows me the autocomplete possibilities, as soon as I start typing. In Version 4.0.3, it shows me no autocomplete suggestions until I typed 2 characters.

Is the new behavior desired? Or is it a bug? Thanks in Advance

B34v0n commented 1 year ago

autocomplete

lukaszlenart commented 1 year ago

I tied to investigate what's wrong, but find nothing. The generated JS has all the options:

jQuery(document).ready(function () {
  var options_languages_widget = {};
  ...
  options_languages_widget.minLength = 2;
  ...

and applies them the the widget, yet this options doesn't work. If I manually applied the option using

$('#languages_widget').autocomplete({minLength: 2});

everything works :\

B34v0n commented 1 year ago

I had some timing Issues with jQuery(document).ready() lately, could changing that to $( window ).on( "load") maybe help with it?

lukaszlenart commented 1 year ago

I checked that, everything is fine, other options (like delay) are applied, just minLength is not. Did that ever work before?

B34v0n commented 1 year ago

Ok, that's strange. Yes, it worked with Version 4.0.3 perfectly. It just "broke" with the Update to Version 5.0.1. in the gif I posted, you can see, that it worked in the showcase in version 4.0.3 as well.

lukaszlenart commented 1 year ago

I found it :) Looks like previously it was minimum option in JQuery UI and now is minLength (there is an intermediate layer which translates options between Struts and JQuery UI)

B34v0n commented 1 year ago

Wow that's great! Thank you. It's always the small things. :D