Editing the data in a List in a Dashcode app

2019-08-28 19:31发布

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?

标签: dashcode
2条回答
Melony?
2楼-- · 2019-08-28 20:04

In dashcode under library/code there is an example titled 'List Data Source'. You will also need to alter the list object datatype to dynamic and then select your datasource from the dropdown list.

查看更多
唯我独甜
3楼-- · 2019-08-28 20:26

It turns out that I wanted to do

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

查看更多
登录 后发表回答