AddOption - method of the PmgWCombo object
Description:
Adds an option into the list (hidden values and visible text).
If the "
Sort" configurator isn't set, then the text is added to the end of the list, otherwise the text is inserted to the corresponding position.
Syntax:
Empty AddOption(String sOption)
Parameters:
sOption | (String) Added option in the form: value=text, where
- value represents the hidden value of the option (identifier),
- text represents the displayed text of the option itself. |
---|
Example:
The example updates the list.
At first it clears the list, then adds three rows and then selects (by index) the third row.
Consequentially it finds the selected text, hidden value and index.
Then the text that is on the 2nd row and finally the number of rows in the list is detected.
JavaScriptVBScriptSelect and copy to clipboard
var oCombo = pMe.Items("/WCombo");
oCombo.RemoveOptions();
oCombo.AddOption("val1=First");
oCombo.AddOption("val2=Second");
oCombo.AddOption("val3=Third");
var sSelText = oCombo.SelectedText;
var sSelValue = oCombo.SelectedValue;
var nSelIndex = oCombo.SelectedIndex;
var sText = oCombo.Options(1);
var nCount = oCombo.OptionsCount;
Dim oCombo
Set oCombo = pMe.Items("/WCombo")
oCombo.RemoveOptions
oCombo.AddOption "val1=First"
oCombo.AddOption "val2=Second"
oCombo.AddOption "val3=Third"
Dim sSelText, sSelValue, nSelIndex
sSelText = oCombo.SelectedText
sSelValue = oCombo.SelectedValue
nSelIndex = oCombo.SelectedIndex
Dim sText
sText = oCombo.Options(1)
Dim nCount
nCount = oCombo.OptionsCount