Class: EMLMissingValueCodeView

EMLMissingValueCodeView()

An EMLMissingValueCodeView provides an editing interface for a single EML Missing Value Code. The view provides two inputs, one of the code and one for the code explanation. If the model is part of a collection, the view will also provide a button to remove the model from the collection.

Screenshot

Constructor

new EMLMissingValueCodeView()

Since:
  • 2.26.0
Source:

Extends

  • Backbone.View

Members

buttonHTML :string

The HTML for the remove button
Type:
  • string
Source:

className :string

The className to add to the view container
Type:
  • string
Source:

classes :Object

The classes to add to the HTML elements in this view
Type:
  • Object
Properties:
Name Type Description
removeButton string The class to add to the remove button
Source:

isNew :boolean

Set this to true if this row is for a blank input row. This will prevent the view from rendering a remove button until the user starts typing.
Type:
  • boolean
Default Value:
  • false
Source:

text :Object

User-facing text strings that will be displayed in this view.
Type:
  • Object
Properties:
Name Type Description
codePlaceholder string The placeholder text for the code input
codeExplanationPlaceholder string The placeholder text for the code explanation input
removeButton string The text for the remove button
Source:

type :string

The type of View this is
Type:
  • string
Source:

Methods

handleTyping(e)

When a user types anything into any input, update the model and show the remove button if it was not yet rendered.
Parameters:
Name Type Description
e Event The event that was triggered by the user
Source:

initialize(options)

Creates a new EMLMissingValueCodeView
Parameters:
Name Type Description
options Object A literal object with options to pass to the view
Properties
Name Type Attributes Description
model EMLAttribute <optional>
The EMLMissingValueCode model to render. If no model is provided, an empty model will be created.
Source:

previewRemove()

When the button is hovered over, indicate visually that the row will be removed when the button is clicked
Source:

removeListeners()

Remove listeners from the view's DOM elements
Source:

removeSelf()

Remove this view from the DOM and collection and remove any event listeners
Source:

render() → {EMLMissingValueCodeView}

Renders this view
Source:
Returns:
A reference to this view
Type
EMLMissingValueCodeView

renderInput(attr) → {Element}

Create and insert the input element for one of the model's attributes. This will add the input to the end of the view's element.
Parameters:
Name Type Description
attr string The name of the attribute to create an input for, either "code" or "codeExplanation"
Source:
Returns:
The input element
Type
Element

renderRemoveButton() → {Element}

Create and insert the remove button
Source:
Returns:
The remove button
Type
Element

setListeners()

Set listeners on the view's DOM elements
Source:

undoPreviewRemove()

When the button is no longer hovered over, undo the visual indication that the row will be removed when the button is clicked
Source:

updateModelFromInput(attr) → {string}

Update the model with the value in the input
Parameters:
Name Type Description
attr string The name of the attribute to update, either "code" or "codeExplanation"
Source:
Returns:
The new value
Type
string