Basically I am trying to implement radio button functionality in Titanium, this works in iphone as expected but in android it allows me to select multiple radio buttons.
Here is my code
var lastRadioBtn = null;
tableViewAns.addEventListener('click', function(e) {
if(e.source.id === undefined) {
Ti.API.info("---IN IF---");
} else {
Ti.API.info("---IN ELSE---");
if(lastRadioBtn != null){
Ti.API.info("---NOT NULL---");
lastRadioBtn.image = '/images/Radio_Button_Not_Selected.png';
}
lastRadioBtn = e.source;
lastRadioBtn.image = '/images/Radio_Button_Selected.png';
}
});
here I created custom row(1 image, text) where image will be selected radio button(on table click) and unselected radio button when any other row will be clicked.
Everything seems to work fine , even in android I get control inside if condition for deselecting image but dont know its not working.
Thanks.
I tried a lot to find its solution but could not resolve it, I tried all property which may be applied(using e.row,e.rowData,e.row.children[i]) every case was working fine with IPhone but failed all the time in Android. I debug, condition was perfectly working with android but do not know why not changing image.
Solution :-
I made one array of images.
Now in table click I manage this array and work with this array instead of table row and this solution works for both Android and Iphone.(Accessing element from array instead getting row of table and then access image.). I hope this will help everyone and this bug(what I am thinking)
will be resolved.
Thanks.