Class: AccordionView

AccordionView()

An extension of the Semantic UI accordion that allows for defining contents with a Backbone model, and adds tooltips and other features.

Screenshot

Constructor

new AccordionView()

Since:
  • 2.31.0
Source:

Extends

  • Backbone.View

Members

className

Source:

tagName

Source:

type

Source:

Methods

addItem(model, container)

Adds an item to the container element for the accordion
Parameters:
Name Type Description
model AccordionItem An AccordionItem model
container HTMLElement The container element for the accordion
Source:

addItems(models, container)

Adds items to the container element for the accordion
Parameters:
Name Type Description
models Array.<AccordionItem> An array of AccordionItem models
container HTMLElement The container element for the accordion
Source:

addNewItem(model)

Handles adding a new item to the accordion when the items collection has new models added to it.
Parameters:
Name Type Description
model AccordionItem The new AccordionItem model
Source:

clearAllItems()

Removes all items from the accordion and clears the itemViews object.
Source:

createAccordion(items) → {HTMLElement}

Creates a container for the accordion with the necessary classes for Semantic UI and renders any items belonging to the accordion. This can be used to create the root accordion or nested accordions.
Parameters:
Name Type Description
items Array.<AccordionItem> An array of AccordionItem models
Source:
Returns:
The container element for the accordion
Type
HTMLElement

createContainer() → {HTMLElement}

Creates a container element for the accordion with the necessary classes
Source:
Returns:
The container element for the accordion
Type
HTMLElement

initialize(options)

Initializes the AccordionView with the model and listens for changes to the items collection.
Parameters:
Name Type Description
options object Options for the view
Properties
Name Type Attributes Description
model Accordion <optional>
The Accordion model for the view. If not provided, a new Accordion model will be created.
modelData object <optional>
Optional data to initialize the Accordion model with. Only used if options.model is not provided.
Source:

initializeAccordion()

Initializes the Semantic UI accordion module with the settings from the model. The module handles applying accordion behavior to the view and any new DOM elements that are added.
Source:

refreshContent(itemId)

Refreshes the content of an item in the accordion. If the item has children, it will create a new accordion with the children. Otherwise, it will update the content with the item's model content attribute.
Parameters:
Name Type Description
itemId string The model itemId for the item
Source:

removeItem(model)

Handles removing an item from the accordion when the items collection has models removed from it.
Parameters:
Name Type Description
model AccordionItem The removed AccordionItem model
Source:

render()

Source:

viewFromContentEl(contentEl) → {AccordionItemView}

Parameters:
Name Type Description
contentEl HTMLElement A content element from an item
Source:
Returns:
The view associated with the item
Type
AccordionItemView