diff --git a/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelect.ts b/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelect.ts index 83bb39ae90..b67b18a5d2 100644 --- a/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelect.ts +++ b/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelect.ts @@ -42,29 +42,10 @@ namespace Providers.OSUI.Dropdown.VirtualSelect { // Manage the attributes to be added private _manageAttributes(): void { - // Check if the pattern should be in disabled mode - this._manageDisableStatus(); - // Manage A11Y attributes this.setA11YProperties(); } - // Manage the disable status of the pattern - private _manageDisableStatus(): void { - if (this.configs.IsDisabled) { - OSFramework.OSUI.Helper.Dom.Attribute.Set( - this.selfElement, - OSFramework.OSUI.GlobalEnum.HTMLAttributes.Disabled, - '' - ); - } else { - OSFramework.OSUI.Helper.Dom.Attribute.Remove( - this.selfElement, - OSFramework.OSUI.GlobalEnum.HTMLAttributes.Disabled - ); - } - } - // Prevent the default behaviour of the event private _onMouseUp(event) { event.preventDefault(); @@ -275,8 +256,6 @@ namespace Providers.OSUI.Dropdown.VirtualSelect { if (this.isBuilt) { switch (propertyName) { case OSFramework.OSUI.Patterns.Dropdown.Enum.Properties.IsDisabled: - this._manageDisableStatus(); - break; case Enum.Properties.NoOptionsText: case Enum.Properties.NoResultsText: case Enum.Properties.OptionsList: @@ -319,10 +298,9 @@ namespace Providers.OSUI.Dropdown.VirtualSelect { * @memberof Providers.OSUI.Dropdown.VirtualSelect.AbstractVirtualSelect */ public disable(): void { - if (this.configs.IsDisabled === false) { + if (this.configs.IsDisabled === false && this.provider !== undefined) { this.configs.IsDisabled = true; - - this._manageDisableStatus(); + this.provider.$ele.disable(); } } @@ -359,10 +337,9 @@ namespace Providers.OSUI.Dropdown.VirtualSelect { * @memberof Providers.OSUI.Dropdown.VirtualSelect.AbstractVirtualSelect */ public enable(): void { - if (this.configs.IsDisabled) { + if (this.configs.IsDisabled && this.provider !== undefined) { this.configs.IsDisabled = false; - - this._manageDisableStatus(); + this.provider.$ele.enable(); } } diff --git a/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelectConfig.ts b/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelectConfig.ts index e91fb1b27f..623baa09f9 100644 --- a/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelectConfig.ts +++ b/src/scripts/Providers/OSUI/Dropdown/VirtualSelect/AbstractVirtualSelectConfig.ts @@ -180,6 +180,7 @@ namespace Providers.OSUI.Dropdown.VirtualSelect { // Set the library options this._providerOptions = { ele: this.ElementId, + disabled: this.IsDisabled, dropboxWrapper: OSFramework.OSUI.GlobalEnum.HTMLElement.Body, hasOptionDescription: hasDescription, hideClearButton: false,