APIs

Show:

defaultSelection and defaultValue are what show as the first option in the select. They should NOT be used to provide the initial set value (i.e. when displaying form data during a model edit For existing selected values, please use the value option

Constructor

awa.ui.CollectionSelect

(
  • options.collection
  • [options.model]
  • [options.modelAttribute]
  • [options.defaultSelection]
  • [options.generateDefault]
  • [options.showDisabled]
  • [options.showDisabledOption]
  • [options.defaultKey]
  • [options.defaultValue]
  • [options.value]
)

Parameters:

  • options.collection awa.mvc.Collection

    Note: If this collection is not an instance of Backbone.Collection and it contains keys beginning with "_" (e.g. "_privateKey", "_keyName", etc.), those keys will not be displayed in the select.

  • [options.model] awa.mvc.Model optional
  • [options.modelAttribute] String optional

    attribute of the model to bind to

  • [options.defaultSelection] String optional

    default option element value to set the select to (usually empty string or 0)

  • [options.generateDefault] Boolean optional

    If true then generate a default option for the select.

  • [options.showDisabled] Boolean optional

    Allow the user to see disabled models. Defaults to false.

  • [options.showDisabledOption] Boolean optional

    Presents the option to show disabled models. ignored if showDisabled is true

  • [options.defaultKey] String optional

    value of default option

  • [options.defaultValue] String optional

    text content of default option

  • [options.value] String optional

    the current value the select is or should be set to

Methods

buildDefaultOption

() HTMLOptionElement | Boolean

If a default option is given, create the element.

Returns:

HTMLOptionElement | Boolean:

Returns either a select option or true,false

setCollection

(
  • collection
)
awa.ui.CollectionSelect chainable

Sets the collection for the select. Note: this does not rebuild the collection. You must call rebuild yourself.

Parameters:

Returns:

awa.ui.CollectionSelect:

returns this