Skip to content

Commit

Permalink
Merge pull request #9 from JJJ/issue/2923
Browse files Browse the repository at this point in the history
Issue/2923
  • Loading branch information
JJJ authored Jul 22, 2020
2 parents d0ca567 + 4659757 commit 4b6dd91
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ class Chosen extends AbstractChosen
close_link = $('<a />', { class: 'search-choice-close', 'data-option-array-index': item.array_index })
close_link.on 'click.chosen', (evt) => this.choice_destroy_link_click(evt)
choice.append close_link
if @inherit_option_classes && item.classes
choice[0].classList.add item.classes

@search_container.before choice

Expand Down
2 changes: 2 additions & 0 deletions coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ class @Chosen extends AbstractChosen
close_link = new Element('a', { href: '#', class: 'search-choice-close', rel: item.array_index })
close_link.observe "click", (evt) => this.choice_destroy_link_click(evt)
choice.insert close_link
if @inherit_option_classes && item.classes
choice[0].classList.add item.classes

@search_container.insert { before: choice }

Expand Down
1 change: 1 addition & 0 deletions coffee/lib/abstract-chosen.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AbstractChosen
@single_backstroke_delete = if @options.single_backstroke_delete? then @options.single_backstroke_delete else true
@max_selected_options = @options.max_selected_options || Infinity
@inherit_select_classes = @options.inherit_select_classes || false
@inherit_option_classes = @options.inherit_option_classes || false
@display_selected_options = if @options.display_selected_options? then @options.display_selected_options else true
@display_disabled_options = if @options.display_disabled_options? then @options.display_disabled_options else true
@include_group_label_in_selected = @options.include_group_label_in_selected || false
Expand Down
5 changes: 5 additions & 0 deletions public/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ <h3>Example:</h3>
<td>false</td>
<td>When set to <code class="language-javascript">true</code>, Chosen will grab any classes on the original select field and add them to Chosen’s container div.</td>
</tr>
<tr>
<td>inherit_option_classes</td>
<td>false</td>
<td>When set to <code class="language-javascript">true</code>, Chosen will grab any classes on the original option tags and add them to Chosen’s container li.</td>
</tr>
<tr>
<td>max_selected_options</td>
<td>Infinity</td>
Expand Down

0 comments on commit 4b6dd91

Please sign in to comment.