これは、SDK v 3.0.2 GA と Alloy フレームワークを使用して、iPhone シミュレーターで実行されるモバイル アプリ用です。
テーブルビューの上にオートコンプリート検索バーがあるテーブルビューを持つウィンドウがあります。オートコンプリートが起動し始めると、検索ボックスの下に結果を含むテーブルビューが表示され、ユーザーが結果から選択できるようになります。
これはすべて正常に機能しますが、検索ビューに TableView を含めると、元のウィンドウの TableView が消えてしまいます。
コードは次のとおりです。
myPlaces.xml
<Alloy>
<Window id="myDrawersWin">
<RightNavButton>
<Button id="showMyDrawers" title="Show Drawers" />
</RightNavButton>
<Require src="findPlace" id="findPlace"/>
<TableView id="placeListTable"/>
</Window>
</Alloy>
findPlace.xml
<Alloy>
<View id="searchContainer">
<TextField id="searchInput" hintText="Find a place..." />
</View>
<TableView id="searchResultsTable"/>
</Alloy>
findPlace.js
$.searchInput.addEventListener("change", function(){
if ($.searchInput.value.length > 2 && $.searchInput.value != "Find a place...") {
// do the search and get a response successfully
_.each(returnedVenues, function(venue){
tblData.push(Alloy.createController("venueSearchListItem", venue).getView());
});
$.searchResultsTable.setData(tblData);
$.searchResultsTable.visible = true;
},
onerror: function(e){
console.log("error");
console.log(e);
}
});
// invoke the HTTP client here
}
else {
$.searchResultsTable.visible = false;
}
});
findPlace.xml
"#searchContainer":{
width: "100%",
height: 50,
backgroundColor: "#B8D0DB",
top: 0
}
"#searchInput":{
width: "80%",
height: 30,
backgroundColor: "#FFFFFF"
}
"#searchResultsTable":{
width: "80%",
visible: false
}
で TableView をfindPlace.xml
取り出すと、ウィンドウ上の元の TableView (placeListTable) が正常に表示されます。追加すると消えてしまいます。また、その中に TableView を移動する<View id="searchContainer">
と表示されます (ただし、高さの制限があるため、明らかに収まりませんsearchContainer
)。
何か案は?これはバグですか、それともここで愚かなことをしていますか?
助けてくれてありがとう。
ジャスティン