Class: DropdownBuilder

DropdownBuilder

DropdownBuilder class builds the DOM for DropdownList class.

Name Type Description
id string

id for the builder. Can be used as the id of the DOM element this builder will build.

Returns:
Type Description
tart.DropdownBuilder A builder object.

Extends

Members

statictart.DropdownBuilder.templates

Main namespace of HTML templates for DOM structure.

protected$domjQueryObject

removeDOM

Removes the DOM part from document.

Methods

Creates a single select option and attachs it to the current DOM.

Name Type Description
key string | number

value for the option.

value string | number

Text for the option.

Returns:
Type Description
jQueryObject the jQuery object that holds the DOM object of the dropdown list.

Generates a select menu element, converts it to a jQuery object and passes to this.$dom.

Name Type Description
owner tart.Collection

Owner tart.Collection instance.

changeActiveItem(newIndex)

Sets an select option's "selected" property to True.

Name Type Description
newIndex number

the new index of the element to set the dropdown list to.

Returns built ready-to-use DOM part in jQuery object format.

Returns:
Type Description
jQueryObject the DOM object built by the builder.

Removes a single select option from DOM by index which given as parameter.

Name Type Description
index number

the index of the element to remove from the list.