Editing the data in a List in a Dashcode app

限于喜欢 提交于 2020-01-06 13:52:54

问题


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?


回答1:


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.




回答2:


It turns out that I wanted to do

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



来源:https://stackoverflow.com/questions/6636834/editing-the-data-in-a-list-in-a-dashcode-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!