Titanium Alloy 无法访问三级嵌套对象
Titanium Alloy can't access third level nested object
我 运行 遇到了 Titanium Alloy 的问题。我似乎无法从控制器访问 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;
这是它给我的错误:
留言="undefined is not an object (evaluating '$.instruction.visible = false')";
@Turtle 是正确的,数据绑定父元素内的 ID(使用 dataCollection
)不能用于通过 $.<id>
到达它们,因为会有不止一个实例。
我 运行 遇到了 Titanium Alloy 的问题。我似乎无法从控制器访问 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;
这是它给我的错误:
留言="undefined is not an object (evaluating '$.instruction.visible = false')";
@Turtle 是正确的,数据绑定父元素内的 ID(使用 dataCollection
)不能用于通过 $.<id>
到达它们,因为会有不止一个实例。