Class pvr.controller.value.types.ChoiceList
Represents a flat or hierarchical choice list.
Defined in: <pvr\controller\value\types\ChoiceList.js>.
Constructor Summary
Constructor Attributes | Constructor Name and Description |
---|---|
Method Summary
Method Attributes | Method Name and Description |
---|---|
equals(choiceList)
Indicates whether this choice list is equal to the specified choice list.
|
|
fromJson(value)
Parses the specific JSON string into a pvr.controller.value.types.ChoiceList object.
|
|
Indicates whether the choice list is hierarchical.
|
|
parse(value)
Parses the specific object into a pvr.controller.value.types.ChoiceList object.
|
|
toJson()
Converts the choice list to a JSON string.
|
Method Detail
equals(choiceList)
Indicates whether this choice list is equal to the specified choice list.
- Parameters:
- choiceList
- The choice list to compare against.
- Returns:
- true if the choice lists are equal.
fromJson(value)
Parses the specific JSON string into a pvr.controller.value.types.ChoiceList object.
- Parameters:
- value
- The JSON string to parse.
- Returns:
- A pvr.controller.value.types.ChoiceList object.
isHierarchical()
Indicates whether the choice list is hierarchical.
- Returns:
- true if the choice list is hierarchical.
parse(value)
Parses the specific object into a pvr.controller.value.types.ChoiceList object.
A variety of formats are supported.
- An array of values. The resulting choice list will be a flat choice list with a default label. The label
for each choice will be derived from the value itself.
[ "red", "green", "blue" ]
- An array of objects. The resulting choice list will be a flat choice list with a default label. A choice
will be created for each object. The value attribute for each choice is required. All other attributes are
optional.
[ { label: "red", value: 0, canAdd: true, canRemove: false }, { label: "green", value: 1, canAdd: true, canRemove: false }, { label: "blue", value: 2, canAdd: true, canRemove: false } ]
- An object containing a label and an array of objects. The label is optional. The resulting choice list
will be a flat choice list with the specified or a default label. A choice will be created for each object.
{ label: "Colors", choices: [ { label: "red", value: 0 }, { label: "green", value: 1 }, { label: "blue", value: 2 } ] }
- An object containing a hierarchical arrangement of choices.
{ label: "Colors", choices: [ { label: "Primary", choices: [ { label: "red", value: 0 }, { label: "green", value: 1 }, { label: "blue", value: 2 } ] }, { label: "Secondary", choices: [ { label: "yellow", value: 3 }, { label: "cyan", value: 4 }, { label: "magenta", value: 5 } ] } ] }
- Parameters:
- value
- The object to parse.
- Returns:
- A pvr.controller.value.types.ChoiceList object.
toJson()
Converts the choice list to a JSON string.
- Returns:
- A JSON string representing the choice list.