繁体   English   中英

无法将数据项添加到钛的列表视图中

[英]not able to add data item to list view in titanium

我正在android上的Alloy(1.2.2)上开发移动应用

<Alloy>
    <View id="settings">    
        <ListItem id="settingsListView">
            <ListSection id="settingsListSection" headerTitle="My Settings">

            </ListSection>
        </ListItem>

    </View>

</Alloy>

settings.js

var settingsListData=[
        {properties:{title:'Profile'}},
        {properties:{title:'Change Password'}},
        {properties:{title:'Edit Clouds'}}
        ];

$.settingsListSection.setItems(settingsListData);

$.settings.open();

它给出错误-对象没有方法'add'为什么会出现此错误? 感谢任何帮助。

您试图打开导致此问题的视图。 由于Ti.UI,View组件没有开放方法。 尝试使用Ti.UI.Window组件代替Ti.UI,View。 例如,将您的settings.xml文件的内容替换为下面的内容,

<Alloy>
    <Window id="settings">    
        <ListItem id="settingsListView">
            <ListSection id="settingsListSection" headerTitle="My Settings">

            </ListSection>
        </ListItem>

    </Window>

</Alloy>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM