[英]Titanium Alloy can't access third level nested object
我遇到了鈦合金的問題。 我似乎無法從控制器訪問XML中聲明的3d級嵌套對象。
這是XML的布局:
<Alloy>
<Collection src="reportDetails"/>
<Window class="container" title="Update Report Details" onClose="cleanup" >
<View id="labels">
<TextArea id="jobTitle" class="title bold" editable="false"></TextArea>
<View class="jobTitleSecondPart" >
<Label class='bold'>last date od service: </Label>
<Label id="jobDate" class="stickLeft"></Label>
<Label class='bold'>Job ID: #</Label>
<Label id="jobId" class="stickLeft"></Label>
</View>
</View>
<ActivityIndicator id="busy"></ActivityIndicator>
<View height="Titanium.UI.FILL">
<ScrollView id="scrollIns" layout="vertical" dataCollection="reportDetails" dataFilter="filterFunction" height="Titanium.UI.FILL">
<View id="instruction"> <!-- ***I am trying to access this object in the controlle***r -->
<Label class="title bold black">Agent Instructions :</Label>
<Label platform="android" id="jobInstruction" html="{agentInstructions}" class="black" height="Titanium.UI.SIZE" />
<WebView platform="ios" id="jobInstruction" html="{agentInstructions}" class="black" touchEnabled="false" height="Titanium.UI.SIZE" />
</View>
<View id="comment">
<Label class="title bold black">Agent Comment :</Label>
<Label id="jobComment" class="black" text="{reportComment}"></Label>
</View>
<Require src="reportImageGallery" images="{images}"/>
</ScrollView>
<View id="buttons">
<Button id="btnInsert" class="bold" onClick="showInsertReport">Insert Update Reports</Button>
</View>
</View>
</Window>
</Alloy>
這是來自控制器的代碼行:
$ .instruction.visible = false;
這是它給我的錯誤:
message =“未定義不是對象(評估'$ .instruction.visible = false')””;
@Turtle是正確的,因為將有一個以上的實例,所以不能使用$.<id>
通過數據綁定的父元素(使用dataCollection
)中的ID來訪問它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.