mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-23 16:02:21 +02:00
Disable at a later stage of intialising
This commit is contained in:
parent
2292b5282f
commit
feb2a15edc
|
@ -8,5 +8,5 @@ install:
|
|||
- npm install
|
||||
script:
|
||||
- npm run test:unit
|
||||
- npm run test:e2e
|
||||
- npm run coverage
|
||||
- npm run test:e2e
|
||||
|
|
|
@ -178,6 +178,7 @@ class Choices {
|
|||
this._createTemplates();
|
||||
this._createElements();
|
||||
this._createStructure();
|
||||
|
||||
// Set initial state (We need to clone the state because some reducers
|
||||
// modify the inner objects properties in the state) 🤢
|
||||
this._initialState = cloneObject(this._store.state);
|
||||
|
@ -185,6 +186,14 @@ class Choices {
|
|||
this._render();
|
||||
this._addEventListeners();
|
||||
|
||||
const shouldDisable =
|
||||
!this.config.addItems ||
|
||||
this.passedElement.element.hasAttribute('disabled');
|
||||
|
||||
if (shouldDisable) {
|
||||
this.disable();
|
||||
}
|
||||
|
||||
this.initialised = true;
|
||||
|
||||
const { callbackOnInit } = this.config;
|
||||
|
@ -1830,13 +1839,6 @@ class Choices {
|
|||
this.input.setWidth(true);
|
||||
}
|
||||
|
||||
if (
|
||||
!this.config.addItems ||
|
||||
this.passedElement.element.hasAttribute('disabled')
|
||||
) {
|
||||
this.disable();
|
||||
}
|
||||
|
||||
this.containerOuter.element.appendChild(this.containerInner.element);
|
||||
this.containerOuter.element.appendChild(this.dropdown.element);
|
||||
this.containerInner.element.appendChild(this.itemList.element);
|
||||
|
|
Loading…
Reference in a new issue