簡體   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