Ability to set item by disabled choice programatically

This commit is contained in:
Josh Johnson 2016-09-21 13:32:21 +01:00
parent 3d45b1d382
commit 53f7207257
5 changed files with 270 additions and 269 deletions

View file

@ -1,4 +1,4 @@
/*! choices.js v2.0.4 | (c) 2016 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! choices.js v2.0.5 | (c) 2016 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -1915,7 +1915,7 @@
this.store.dispatch((0, _index3.addChoice)(value, choiceLabel, choiceId, groupId, isDisabled));
if (isSelected && !isDisabled) {
if (isSelected) {
this._addItem(value, choiceLabel, choiceId);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1643,7 +1643,7 @@ export default class Choices {
this.store.dispatch(addChoice(value, choiceLabel, choiceId, groupId, isDisabled));
if (isSelected && !isDisabled) {
if (isSelected) {
this._addItem(value, choiceLabel, choiceId);
}
}

View file

@ -126,7 +126,8 @@
<h2>Single select input</h2>
<label for="choices-single-default">Default</label>
<select class="form-control" data-choice name="choices-single-default" id="choices-single-default" placeholder="This is a placeholder">
<select class="form-control" data-choice name="choices-single-default" id="choices-single-default" placeholder="This is a search placeholder">
<option selected disabled>This is a placeholder</option>
<option value="Dropdown item 1">Dropdown item 1</option>
<option value="Dropdown item 2">Dropdown item 2</option>
<option value="Dropdown item 3">Dropdown item 3</option>