0
我想關閉窗口後退按鈕,當我第二次按下後退按鈕時。在我的代碼中,我正在運行一個yql查詢並將從查詢獲得的數據插入行中,然後將行添加到表中。我不明白爲什麼我需要按下按鈕2次請幫助。在此先感謝以下是我的代碼:後退按鈕無法正常工作
var DetailWin = Titanium.UI.currentWindow;
var information = new Array("Company Name: ", "Company Location:", "Position Type:", "Employee Type:", "Minimum Education:", "Vacancy:", "Gender:", "Salary:");
var var1=Ti.App.lurl;
var rowData = [];
Titanium.Yahoo.yql('select * from html where url="' + var1 + '" and xpath="//p/span" limit 8', function(e) {
var results = e.data.span;
for (var i = 0; i < results.length; i++) {
var rss = results[i];
var rssRow = Titanium.UI.createTableViewRow({
top : 200,
height : 45,
className : 'rssrow'
});
var titleLabel = Titanium.UI.createLabel({
text : information[i] + " " + rss,
font : {
fontSize : 16,
fontWeight : 'bold'
},
width : 'auto',
top : 5,
left : 40,
height : 20,
color:'black'
});
rssRow.add(titleLabel);
rowData.push(rssRow);
};
jobdetail.setData(rowData);
});
var jobdetail = Titanium.UI.createTableView({
top:'12%',
});
DetailWin.add(jobdetail);
var backbut = Titanium.UI.createButton({
title:'Back',
top:'2%',
width:'20%',
height:'auto',
left:'5%'
});
backbut.addEventListener('click', function(){
DetailWin.close();
});
DetailWin.add(backbut);
您是否嘗試在點擊事件中寫入警報? – Anand