Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Tap event auto re-navigateTo on back button click

Hi.
I have a ui-list of items, where I have a live tap event on each li a.

Working perfectly clicking to view the item, it navigate to correct viewItemScreen.

But when I click "back button" or any other navigation button (example HOME button) in the viewItemScreen, it goes to the correct "itemList/start-screen, but then automatically re-navigate to the itemViewScreen again (me not doing anything, it just re-fire the event for some reason).

Not sure how to stop this from happening. Any suggestion? die() or something after "tap"!?!

ui-list itemsScreen:
code$(".ui-listview").find('a.event-item-link').live("tap",function(){
if($(this).attr("rel")){
localStorage.setItem('eventId', $(this).attr("rel"));
Appery.navigateTo('itemViewScreen',{ transition: 'slide'});
} else {
return false;
}
return false;
});/code

viewItemScreen
codeRegular back button in header/code

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Tap event auto re-navigateTo on back button click

Never mind.. It looks like I have sorted it out now;
code$(".ui-listview").find('a.event-item-link').die().live({
click: function() {
if ($(this).attr("rel")) {
localStorage.setItem('eventId', $(this).attr("rel"));
Appery.navigateTo('itemViewScreen', {
transition: 'slide',
reverse: false
});
}
},
});/code

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Tap event auto re-navigateTo on back button click

Glad you handled it :)

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Tap event auto re-navigateTo on back button click

Hi. After jquery mobile 1.4.0, I noticed that my live click is not working any more. I noticed you re-wrote the button click code for appery components as well (in js files). So now I am wondering, instead of the above, is this the best practice? or should I do it another way?

code

$(".ui-listview").find('.event-item-link').on({
click: function() {
if ($(this).attr("rel")) {
localStorage.setItem('eventId', $(this).attr("rel"));
Appery.navigateTo('itemViewScreen', {
transition: 'slide',
reverse: false
});
}
}
});

/code

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Tap event auto re-navigateTo on back button click

Hi Tom,

Does this code work? Please don't change the library version if you started work with the old one, this will be easier.

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Tap event auto re-navigateTo on back button click

I started a new app from scratch, with latest libs, to see if there are something with me code, and to re-write the whole app more streamlined. So have 2 versions of it now (almost). Yes, the code work, but I am wondering if this is the best approach?

Basicly, I am building a ui-listview, and doing find all A.elements with class="event-item-link", and listen on click to navigate to the "viewpage" for the clicked item.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Tap event auto re-navigateTo on back button click

Tom,

If I understand you correctly, backbutton fires on listview click. If this is so, please post a public link, we'll test it.
Where do you reproduce this behaviour (desktop browser, native app, OS version)?

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Tap event auto re-navigateTo on back button click

Sorry, perhaps I was not clear enough :) I fixed the initial problem, as stated in next thread, but after I started a new app (to find the bloody xcode problem), I had to change the die.live to .on.

And question is simply, is this the best approach?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Tap event auto re-navigateTo on back button click

Tom,

Seems to be okay, use it if it works for you.

Return to “Issues”