Quantcast
Viewing all articles
Browse latest Browse all 8068

Table View Disappearing With Two Table Views on Screen

This is for a mobile app, running on the iPhone simulator, using SDK v 3.0.2 GA and the Alloy framework.

I have a window that has a tableview with an autocompleting search bar atop that table view. When the autocomplete begins to fire, it displays a tableview with the results below the search box, allowing a user to select from the results.

This all works fine, except that including the TableView on the search view causes the TableView on the original window to disappear.

The code is as follows:

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
}
If I take out the TableView in findPlace.xml, the original TableView on the window (placeListTable) shows up fine. If I add it back, it disappears.

Any ideas? Is this a bug, or am I doing something stupid here?

Thanks for any help.

Justin


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>