Hi my button event listener is not working.It was working till yesterday correctly but now it is not working var GlobalVar=new Array(); GlobalaVar=["PHP Web Developer","Drupal Developer"]; var win5 = Titanium.UI.createWindow({ title : 'Tab 5', backgroundColor : '#fff' });
var searchbyjob = Titanium.UI.createTextField({
hintText : 'Search By Job',
top : 25,
borderWidth : 0,
width : 350,
left : 60,
height : 60,
font : {
fontSize : 14,
fontColor : '#262626',
fontFamily : 'Helvetica'
},
autoCorrect : false,
//autocapitalization : Titanium.UI.TEXT_AUTOCAPITALIZATION_ALL,
// keyboardType:Titanium.UI.KEYBOARD_NUMBER_PAD
});
win5.add(searchbyjob);
var searchbycompany = Titanium.UI.createTextField({
hintText : 'Search By Company',
top : 100,
borderWidth : 0,
width : 350,
left : 60,
height : 60,
font : {
fontSize : 14,
fontColor : '#262626',
fontFamily : 'Helvetica'
},
autoCorrect : false,
autocapitalization : Titanium.UI.TEXT_AUTOCAPITALIZATION_ALL
});
win5.add(searchbycompany);
// Create the search button from our search.png image
var btnSearchcompany = Titanium.UI.createButton({
backgroundImage : 'images/search.png',
top : 112,
width : 80,
height : 30,
right : 75,
borderRadius : 3
});
win5.add(btnSearchcompany);
/ / Create the search button from our search.png image
var btnSearchjob = Titanium.UI.createButton({
backgroundImage : 'images/search.png',
top : 37,
width : 80,
height : 30,
right : 75,
borderRadius : 3
});
win5.add(btnSearchjob);
var tableView2 = Titanium.UI.createTableView();
win5.add(tableView2);
btnSearchjob.addEventListener('click', function(e) {
searchyql();
});
function searchyql(){
var n = 0;
var count = 0;
var a = GlobalVar.length;
for (var i = 0; i < GlobalVar.length; i++) {
alert(GlobalVar[i]);
n++;
if (GlobalVar[i] == searchbyjob.value) {
btnSearchjob.hide();
btnSearchcompany.hide();
searchbyjob.hide();
searchbycompany.hide();
count++;
var Row = [];
Titanium.Yahoo.yql('select * from html where url="http://afghanskills.com/all-jobs.php" and xpath="//tbody/tr[' + n + ']/td/font"', function(e) {
var results = e.data.font;
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 : rss.content,
font : {
fontSize : 16,
fontWeight : 'bold'
},
width : 'auto',
top : 5,
left : 40,
height : 16
});
rssRow.add(titleLabel);
Row.push(rssRow);
};
tableView2.setData(Row);
});
} else if (n == a - 1 && count == 0) {
alert("Your Job IS NOT FOUND");
}
}
} win5.open();
1 Answer
There are two button on it and which one is not working...
var btnSearchcompany = Titanium.UI.createButton({ //button 1 does not have any event listener backgroundImage : 'images/search.png', top : 112, width : 80, height : 30, right : 75, borderRadius : 3 }); win5.add(btnSearchcompany); / / Create the search button from our search.png image var btnSearchjob = Titanium.UI.createButton({ //button 2 has event listener. backgroundImage : 'images/search.png', top : 37, width : 80, height : 30, right : 75, borderRadius : 3 });for button 2 click event.. put the log message on click and put that console message here... and also confirm that its tapped properly.. there is no hidden view also.
Your Answer
Think you can help? Login to answer this question!