src/dual-listbox.js
/**
     * Action to set all listItems to selected.
     */
Action to set all listItems to selected.
Action to set all listItems to selected .
_actionAllSelected(event) {
        event.preventDefault();
        let selected = this.available.filter(
            (item) => item.style.display !== "none"
        );
        selected.forEach(function (listItem) {
            let index = this.available.indexOf(listItem);
            if (index > -1) {
                this.available.splice(index, 1);
                this.selected.push(listItem);
                this._selectOption(listItem.dataset.id);
                setTimeout(() => {
                    let event = document.createEvent("HTMLEvents");
                    event.initEvent("added", false, true);
                    event.addedElement = listItem;
                    this.dualListbox.dispatchEvent(event);
                }, 0);
            }
        });
        this.redraw();
    }
_actionAllSelected ( event ) { event . preventDefault ( ) ; let selected = this . available . filter ( ( item ) => item . style . display !== "none" ) ; selected . forEach ( function ( listItem ) { let index = this . available . indexOf ( listItem ) ; if ( index > - 1 ) { this . available . splice ( index , 1 ) ; this . selected . push ( listItem ) ; this . _selectOption ( listItem . dataset . id ) ; setTimeout ( ( ) => { let event = document . createEvent ( "HTMLEvents" ) ; event . initEvent ( "added" , false , true ) ; event . addedElement = listItem ; this . dualListbox . dispatchEvent ( event ) ; } , 0 ) ; } } ) ; this . redraw ( ) ; }
Action to set all listItems to selected.
Action to set all listItems to selected .