szn-options.js
function updateUi(instance) {
    if (!instance._options) {
      return
    }

    if (instance._options.disabled) {
      instance._root.setAttribute('disabled', '')
    } else {
      instance._root.removeAttribute('disabled')
    }
    if (instance._options.multiple) {
      instance._root.setAttribute('data-szn-options--multiple', '')
    } else {
      instance._root.removeAttribute('data-szn-options--multiple')
    }

    updateGroupUi(instance._root, instance._options)
    if (instance._mounted) {
      const options = instance._options.options
      let lastSelectedIndex = -1
      for (let i = options.length - 1; i >= 0; i--) {
        if (options.item(i).selected) {
          lastSelectedIndex = i
          break
        }
      }
      scrollToSelection(instance, instance._options.selectedIndex, lastSelectedIndex)
    }
  }
function updateUi(instance) {
    if (!instance._options) {
      return
    }

    if (instance._options.disabled) {
      instance._root.setAttribute('disabled', '')
    } else {
      instance._root.removeAttribute('disabled')
    }
    if (instance._options.multiple) {
      instance._root.setAttribute('data-szn-options--multiple', '')
    } else {
      instance._root.removeAttribute('data-szn-options--multiple')
    }

    updateGroupUi(instance._root, instance._options)
    if (instance._mounted) {
      const options = instance._options.options
      let lastSelectedIndex = -1
      for (let i = options.length - 1; i >= 0; i--) {
        if (options.item(i).selected) {
          lastSelectedIndex = i
          break
        }
      }
      scrollToSelection(instance, instance._options.selectedIndex, lastSelectedIndex)
    }
  }
function updateUi ( instance ) { if ( ! instance . _options ) { return } if ( instance . _options . disabled ) { instance . _root . setAttribute ( 'disabled' , '' ) } else { instance . _root . removeAttribute ( 'disabled' ) } if ( instance . _options . multiple ) { instance . _root . setAttribute ( 'data-szn-options--multiple' , '' ) } else { instance . _root . removeAttribute ( 'data-szn-options--multiple' ) } updateGroupUi ( instance . _root , instance . _options ) if ( instance . _mounted ) { const options = instance . _options . options let lastSelectedIndex = - 1 for ( let i = options . length - 1 ; i >= 0 ; i -- ) { if ( options . item ( i ) . selected ) { lastSelectedIndex = i break } } scrollToSelection ( instance , instance . _options . selectedIndex , lastSelectedIndex ) } }
Updates the UI, if the provided szn-options element has already been provided with the options to display. The
functions synchronizes the displayed UI to reflect the available options, their status, and scrolls to the last
selected option if it is not visible.

@param {SznElements.SznOptions} instance The szn-options element's instance.
Updates the UI if the provided szn - options element has already been provided with the options to display . The functions synchronizes the displayed UI to reflect the available options their status and scrolls to the last selected option if it is not visible .