I have a mapview whose annotations are pulled from an XML file.
var annot = Ti.Map.createAnnotation ({ latitude:lat, longitude:lon, title:title, pincolor: Ti.Map.ANNOTATION_RED, rightButton: Titanium.UI.iPhone.SystemButton.DISCLOSURE, animate:true, myid:1 // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS });This is my rightbutton click event
mapview.addEventListener('click',function(evt) { // map event properties var annotation = evt.annotation; var title = evt.title; var clickSource = evt.clicksource; // custom annotation attribute var myid = evt.annotation.myid; // use custom event attribute to determine if atlanta annotation was clicked if (myid == 1 && evt.clicksource == 'rightButton') { //I want to open up a description page that is pulled from the same XML file but it's in Detail.js file });This is my sites.js which is coming from the same XML file
var find = Ti.UI.createView({ top:0, bottom:45 }); // create table view data object var siteData = []; var tableview3 = Ti.UI.createTableView({ data: [], separatorColor:'#6fab70' }); find.add(tableview3); tableview3.addEventListener('click',function(e){ if(!!e.rowData.tagName20){ var win = Titanium.UI.createWindow({ title:"Detailed Description", backgroundcolor:"#ffffff", barColor:"#6fab70", url:"Detail.js" }); win.sitedesc = "Description: " +e.rowData.tagName10; win.title = e.rowData.tagName20; win.sitefullimage = e.rowData.image; Titanium.UI.currentTab.open(win,{animation:true}); } });on tableview click event, it will open up a detailed description page 'Detail.js'
var win = Ti.UI.currentWindow; var sitedesc = win.sitedesc; var title = win.title; var sitefullimage = win.sitefullimage; //it has lables and views that will use the above variables.So my question is, how do I display details in Detail.js file when corresponding annotation's rightbutton is clicked in mapview?
1 Answer
I did it like this
mapview.addEventListener('click', function(evt) {
if (evt.clicksource == 'rightPane') {
win.open()
};
}
but if you click the same rightbutton more than once it will freeze the win.close() function. can anybody help?
Your Answer
Think you can help? Login to answer this question!