src/dual-listbox.js
/**
     * Creates the buttons to add/remove the selected item.
     */
Creates the buttons to add/remove the selected item.
Creates the buttons to add / remove the selected item .
_createButtons() {
        this.buttons = document.createElement("div");
        this.buttons.classList.add(BUTTONS_ELEMENT);
        this.add_all_button = document.createElement("button");
        this.add_all_button.innerHTML = this.addAllButtonText;
        this.add_button = document.createElement("button");
        this.add_button.innerHTML = this.addButtonText;
        this.remove_button = document.createElement("button");
        this.remove_button.innerHTML = this.removeButtonText;
        this.remove_all_button = document.createElement("button");
        this.remove_all_button.innerHTML = this.removeAllButtonText;
        const options = {
            showAddAllButton: this.add_all_button,
            showAddButton: this.add_button,
            showRemoveButton: this.remove_button,
            showRemoveAllButton: this.remove_all_button,
        };
        for (let optionName in options) {
            if (optionName) {
                const option = this[optionName];
                const button = options[optionName];
                button.setAttribute("type", "button");
                button.classList.add(BUTTON_ELEMENT);
                if (option) {
                    this.buttons.appendChild(button);
                }
            }
        }
    }
_createButtons ( ) { this . buttons = document . createElement ( "div" ) ; this . buttons . classList . add ( BUTTONS_ELEMENT ) ; this . add_all_button = document . createElement ( "button" ) ; this . add_all_button . innerHTML = this . addAllButtonText ; this . add_button = document . createElement ( "button" ) ; this . add_button . innerHTML = this . addButtonText ; this . remove_button = document . createElement ( "button" ) ; this . remove_button . innerHTML = this . removeButtonText ; this . remove_all_button = document . createElement ( "button" ) ; this . remove_all_button . innerHTML = this . removeAllButtonText ; const options = { showAddAllButton : this . add_all_button , showAddButton : this . add_button , showRemoveButton : this . remove_button , showRemoveAllButton : this . remove_all_button , } ; for ( let optionName in options ) { if ( optionName ) { const option = this [ optionName ] ; const button = options [ optionName ] ; button . setAttribute ( "type" , "button" ) ; button . classList . add ( BUTTON_ELEMENT ) ; if ( option ) { this . buttons . appendChild ( button ) ; } } } }
Creates the buttons to add/remove the selected item.
Creates the buttons to add / remove the selected item .