render() {
        this.clear()
        this.combobox_content_text.innerHTML = `${this.selectedValue}`
        for (var i = 0; i < this.content.length; i++) {
            var newElement = document.createElement('div')
            newElement.innerHTML = `
            <style>
            .gus_combobox_element {
                height: 50px;
                width: 100%;

                display: grid;
                align-items: center;

                background: var(--gus-ui-color-surface);

                cursor: pointer;
                transition: 0.1s;
            }
            .gus_combobox_element:hover {
                background: var(--gus-ui-color-surface-hover);
                transition: 0.1s;
            }
            .gus_combobox_element_text {
                margin-left: 20px;
            }
            </style>
            <div class="gus_combobox_element" part="combobox_element">
                <p class="gus_combobox_element_text" part="combobox_element_text">${this.content[i]}</p>
            </div>
            `
            newElement.addEventListener("click", (e) => {
                var newSelectedValue = null

                if (e.target.children.length > 0) {
                    newSelectedValue = e.target.children[0].innerHTML
                }
                else {
                    newSelectedValue = e.target.innerHTML
                }

                this.selectedValue = newSelectedValue // Store the new Selected Value

                this.combobox_content_text.innerHTML = this.selectedValue // Display it

                this.dispatchEvent(this.event_valueChanged)

                this.toggleComboBox() // Toggle the combobox
            })
            this.combobox_elements.appendChild(newElement)
        }
    }
// Re-render the whole combo box
Re-render the whole combo box
Re - render the whole combo box
render() {
        this.clear()
        this.combobox_content_text.innerHTML = `${this.selectedValue}`
        for (var i = 0; i < this.content.length; i++) {
            var newElement = document.createElement('div')
            newElement.innerHTML = `
            <style>
            .gus_combobox_element {
                height: 50px;
                width: 100%;
                display: grid;
                align-items: center;
                background: var(--gus-ui-color-surface);
                cursor: pointer;
                transition: 0.1s;
            }
            .gus_combobox_element:hover {
                background: var(--gus-ui-color-surface-hover);
                transition: 0.1s;
            }
            .gus_combobox_element_text {
                margin-left: 20px;
            }
            </style>
            <div class="gus_combobox_element" part="combobox_element">
                <p class="gus_combobox_element_text" part="combobox_element_text">${this.content[i]}</p>
            </div>
            `
            newElement.addEventListener("click", (e) => {
                var newSelectedValue = null
                if (e.target.children.length > 0) {
                    newSelectedValue = e.target.children[0].innerHTML
                }
                else {
                    newSelectedValue = e.target.innerHTML
                }
                this.selectedValue = newSelectedValue 
                this.combobox_content_text.innerHTML = this.selectedValue 
                this.dispatchEvent(this.event_valueChanged)
                this.toggleComboBox() 
            })
            this.combobox_elements.appendChild(newElement)
        }
    }
render ( ) { this . clear ( ) this . combobox_content_text . innerHTML = ` ${ this . selectedValue } ` for ( var i = 0 ; i < this . content . length ; i ++ ) { var newElement = document . createElement ( 'div' ) newElement . innerHTML = ` ${ this . content [ i ] } ` newElement . addEventListener ( "click" , ( e ) => { var newSelectedValue = null if ( e . target . children . length > 0 ) { newSelectedValue = e . target . children [ 0 ] . innerHTML } else { newSelectedValue = e . target . innerHTML } this . selectedValue = newSelectedValue this . combobox_content_text . innerHTML = this . selectedValue this . dispatchEvent ( this . event_valueChanged ) this . toggleComboBox ( ) } ) this . combobox_elements . appendChild ( newElement ) } }
Re-render the whole combo box
Re - render the whole combo box
// Store the new Selected Value // Display it // Toggle the combobox