Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Despite checking the " Search also in the middle of words " checkbox, chosen widgets will not return any result unless starting from the beginning of the search term.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2118537-chosen-options-rework.patch | 5.31 KB | Dave Reid |
#8 | 2118537-chosen-options-rework.patch | 4.94 KB | Dave Reid |
#2 | widget_no_search_middle-chosen-2118537-2.diff | 2.24 KB | MiroslavBanov |
Comments
Comment #1
tymn CreditAttribution: tymn commentedI'm also experiencing this issue with the latest recommended and dev releases. As well as 'search in the middle' not working it was also not using my custom placeholder text. I've reverted back to the previous version I was using (7.x-2.0-alpha2+13-dev) which is working fine.
Comment #2
MiroslavBanov CreditAttribution: MiroslavBanov commentedThe bug is that widgets do not receive the settings/options of chosen.
Problem was introduced with this commit https://drupal.org/comment/7876589#comment-7876589
of this patch https://drupal.org/comment/7861437#comment-7861437
The settings/options had to be applied for every matched select, but there are two selectors in the chosen js behavior.
Attached is a patch that resolves the problem, without duplication of code.
Comment #3
maximpodorov CreditAttribution: maximpodorov commentedThe correct fix.
Marking my issue as duplicate: #2170113: Options for widgets are lost
Comment #4
maximpodorov CreditAttribution: maximpodorov commentedAny plans to accept this patch?
Comment #5
maximpodorov CreditAttribution: maximpodorov commented@Dave Reid, excuse me for the annoyance, do you think it's a right fix?
Comment #6
Dave ReidI think it does although the way it is implemented as a var which is a function doesn't actually seem correct.
Just looking at the code, I don't understand why we can almost have a complete options object provided in Drupal.settings.chosen, and use that rather than having to 'construct' it every time.
Comment #7
maximpodorov CreditAttribution: maximpodorov commentedIt's because of 'width' parameter (part of options) which is calculated for every element separately.
Comment #8
Dave ReidSo we were a little on the right track with having a function to get the options, but I improved it a bit more. All of the default options are not contained in Drupal.settings.chosen.options. I've tested this and it seems to work much better and helps simplify stuff that needs to be applied to every chosen element (like minimum width calculation).
Comment #9
Dave ReidComment #10
Dave ReidForgot inherit_select_classes...
Comment #11
Dave ReidTested and committed #10 to 7.x-2.x: http://drupalcode.org/project/chosen.git/commit/3816a20
Comment #12
maximpodorov CreditAttribution: maximpodorov commentedThanks. Chosen is usable now.