I'm struck with one issue in my project.Actually i'm doing json parse in my project it's working fine, and gettting all in the table and i'm adding the table to the window. And i'm calling that json parse form text field "change" . Every time when i'm giving the value in the text filed new window is creating, but i need only one window even thought I enter many values in the text filed and i wrote the code like this can any one help me please
countryfield.addEventListener('change',function(){ var countrywindow = Titanium.UI.createWindow({ backgroundColor:'#EEEEEE', //top:w2.top+countryfield.top+countryfield.height+00, top:(Ti.Platform.displayCaps.platformWidth/1.25)-5, borderColor:'#999', height:Ti.Platform.displayCaps.platformWidth/1.6, width:Ti.Platform.displayCaps.platformWidth/1.6, //transform:location }); countrywindow.open(); countrywindow.animate({ right: 160, bottom: 20, duration: 500, curve:Titanium.UI.ANIMATION_CURVE_EASE_OUT }); var countryurl = "http://173.230.148.65/openbravo/org.openbravo.service.json.jsonrest/Country?_where=name%20like%20%27%25"+countryfield.value+"%25%27"; // alert(countryurl) var countrytableData = [ ]; var countrytable = Ti.UI.createTableView(); var countryjson,response, data, fighter, i, json2, nameLabel,row; var countryxhr = Titanium.Network.createHTTPClient({ username: "DemoClient", password: "democlient", onload : function() { Ti.API.info(url); countryjson = JSON.parse(this.responseText); for (var i=0,len = countryjson.response.data.length; i < len; i++){ countryfighter = countryjson.response.data[i]; var countryrow = Ti.UI.createTableViewRow({ height:'60dp', backgroundColor:'EEEEEE', data:countryfighter.name, //backgroundImage:'/images/BG.png' }); var countryrow1 = Ti.UI.createTableViewRow({ height:'60dp', data:countryfighter.client, backgroundColor:'white' }); var countrylabelTitle = Ti.UI.createLabel({ text: countryfighter.name, left:'2%', color:"#666666", font:{fontSize: 22, fontWeight: 'bold'} }); countryrow.lbl = countrylabelTitle; countryrow.add(countrylabelTitle); countrytableData.push(countryrow); } countrytable.setData(countrytableData); // $.searchField.add(table); // $.list.setData(tableData); }, onerror : function(e) { alert('Network error '+e.error); } }); countryxhr.open('GET',countryurl); countryxhr.send(); countrywindow.add(countrytable); });here "countryfield" is the textfield name