Class InputElementDDL
A drop-down-list object, not a true input but very similar.
Defined in: inputElement.js.
Constructor Attributes | Constructor Name and Description |
---|---|
InputElementDDL(tag)
|
Method Attributes | Method Name and Description |
---|---|
addOption(txt, val, def, sel)
Adds a single option to a drop-down-list.
|
|
addOptionList(list)
Adds a list of strings to a drop-down-list as options
|
|
appendTo(parent)
Appends the drop-down-list and any label to a DOM node
|
|
Return the number of options in the list.
|
|
Return the index of the currently selected row.
|
|
Return the value of the currently selected row, or null if none selected.
|
|
onChange(listener)
|
|
select(ix)
|
|
selectByValue(find)
Causes the option whose value is specified to become the currently selected option
|
|
setLabel(text)
Sets the text for the associated label.
|
|
setTextAlign(text)
Sets the text alignment for the associated label.
|
Class Detail
InputElementDDL(tag)
languageDDL = new InputElementDDL('ddlLanguage');
- Parameters:
- {string} tag
- The name and id of this object.
Method Detail
addOption(txt, val, def, sel)
Adds a single option to a drop-down-list. Uses the standard JavaScript Option class, so
takes the same argument list. If no value is specified, the text argument is used as the value.
languageTable.addOption('French','FR');
- Parameters:
- txt
- val
- def
- sel
addOptionList(list)
Adds a list of strings to a drop-down-list as options
languageTable.addOptionList(myList);
- Parameters:
- {array} list
- An array of strings to become list options
appendTo(parent)
Appends the drop-down-list and any label to a DOM node
- Parameters:
- {DOM element} parent
- The DOM node to which this is added
{number}
getRowCount()
Return the number of options in the list.
- Returns:
- {number} The option count.
{number}
getSelectedRow()
Return the index of the currently selected row. Follows usual rules for HTML selectedIndex.
- Returns:
- {number} Index corresponding to the selected (or first selected) row.
{number}
getSelectedValue()
Return the value of the currently selected row, or null if none selected.
- Returns:
- {number} Value corresponding to the selected (or first selected) row.
onChange(listener)
- Parameters:
- listener
select(ix)
- Parameters:
- ix
selectByValue(find)
Causes the option whose value is specified to become the currently selected option
languageTable.selectByValue('French');
- Parameters:
- {string} find
- The value of the option to make selected
setLabel(text)
Sets the text for the associated label.
- Parameters:
- {string} text
- The label for this object.
setTextAlign(text)
Sets the text alignment for the associated label. Default is left.
- Parameters:
- {string} text
- Should be either 'left' or 'right', depending on where you want the label.