Search code examples
dashcode

Editing the data in a List in a Dashcode app


I’m writing a Dashcode app that contains a list. I’d like to populate this list with my data, but when I define the function

function populate_list()
{
    var list = document.getElementById("list");
    list.setDataArray(test_data);
    list.reloadData();
}

I get an error; I think the reason is that list in this context is a normal HTML ul element and not an instance of the fancy DC.List class that Apple has defined. How can I access my list in such a way that I can use its methods and access its properties?


Solution

  • It turns out that I wanted to do

    var list = document.getElementById("list").object;