Question
Accessing nested objects and arrays for SetItems method
Hi,
I have a dropdown menu ("Dropdown1"), that I need to populate with options from the object I have defined below. How would I go about populating Dropdown1 with the names (Name1, Name2, & Name3) from the Class1 array?
var oClassList =
{
Class1:
[
{name: "Name1", company: "Company1", instructor: "Instructor1"},
{name: "Name2", company: "Company2", instructor: "Instructor1"},
{name: "Name3", company: "Company3", instructor: "Instructor1"}
],
Class2:
[
{name: "Name1", company: "Company1", instructor: "Instructor2"},
{name: "Name2", company: "Company2", instructor: "Instructor2"},
{name: "Name3", company: "Company3", instructor: "Instructor2"}
],
Class3:
[
{name: "Name1", company: "Company1", instructor: "Instructor3"},
{name: "Name2", company: "Company2", instructor: "Instructor3"},
{name: "Name3", company: "Company3", instructor: "Instructor3"}
]
};I tried the following code using the setItems method, but I couldn't get it to work:
this.getField("Dropdown1").setItems(oClassList.Class1.name);
