I am developing an iOS 6.1 app using Titanium Studio, build: 3.1.2.201307091805, testing on the iPhone simulator and iPad device. I have a search field that gets results from a remote server. The screen I am having issues with has the search box at the top and a couple of messages below. When the user types in the search field and hits return, the messages are hidden and a table is placed ready to receive the results from the database. All of that is working fine. When the user types in something that is not in the database I have a message appear "No results found, please try again". The issue is I do not know how to clear that table and prepare for the next results. Here is a snippet of code I have so far:
var customSearchField = Ti.UI.createTextField({ autocorrect: false, borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED, clearOnEdit: true, height: 28, hintText: 'Search For Product or Service', textAlign: 'center', width: '90%', }); customSearchBar.add(customSearchField); function checkInternetConnection(){ return Ti.Network.online ? true : false; } customSearchField.addEventListener("return", function(e) { if(checkInternetConnection()){ nolist.hide(); businessowner.hide(); view.add(table); win.add(view);I think I need to add something to my event listener but not sure what. Would someone be so kind to show me what code to put where to achieve my desired result?