Skip to main content

ElementCheckboxDropdown

Namespace for creating (DOM-based) dropdown menus filled with checkboxes

Index

Functions

_CreateCheckboxPair

  • _CreateCheckboxPair(idPrefix, idSuffix, spanText, listener, checked): HTMLOptions<label>

  • Parameters

    • idPrefix: string
    • idSuffix: string
    • spanText: string
    • listener: (this, event) => void
      • checked: boolean = false

      Returns HTMLOptions<label>

    FromList

    • FromList(id, checkboxList, eventListener, options): HTMLDivElement
    • Construct a dropdown menu with labeled checkboxes


      Parameters

      • id: string

        The ID of the element

      • checkboxList: readonly string[]

        The checkbox labels

      • eventListener: (this, event) => void

        The event listener to-be attached to all checkboxes

        • optionaloptions: { checked: boolean; parent: HTMLElement } = undefined
          • checked: boolean

            Whether all checkboxes should be initially checked

          • parent: HTMLElement

            The parent element of the dropdown menu; defaults to document.body

        Returns HTMLDivElement

        • The created dropdown menu

      FromRecord

      • FromRecord(id, checkboxRecord, eventListener, options): HTMLDivElement
      • Construct a dropdown menu with labeled checkboxes, each group of checkboxes having a header associated with them


        Parameters

        • id: string

          The ID of the element

        • checkboxRecord: Record<string, readonly string[]>

          The checkbox labels

        • eventListener: (this, event) => void

          The event listener to-be attached to all checkboxes

          • optionaloptions: { checked: boolean; parent: HTMLElement } = undefined
            • checked: boolean

              Whether all checkboxes should be initially checked

            • parent: HTMLElement

              The parent element of the dropdown menu; defaults to document.body

          Returns HTMLDivElement

          • The created dropdown menu