Page 1 of 1

Refresh page with android mobile back button

Posted: Tue Mar 25, 2014 1:48 pm
by Mark6753445

Hi guys

I have a weird problem I'm hoping someone can help with please.

On my startscreen I have a table within the page that is set to 100% 100% and the following code is used 'pageshow'
Appery("mobilegrid_5").parent().css("height", Appery("f1bstart").css("height"));
I loaded this on my mobile and when the page is loaded for the first time, everything works well.
I then go to page2 and when I use the mobile device back button to go back to startscreen the table is now not aligned properly and the footer disappears.

The code above only seems to work once and not everytime the startscreen opens.
I tried to use 'page hide' on page2 and then navigate to page using full refresh but this loads startscreen and then refreshes again so it goes black for 2 seconds.

Is there a way to have the startscreen code activate EVERY time the page opens? The problem also happens if I have a back button on page2.

What I really need is EVERY time this page is shown, to activate the above code.

I hope that makes sense, let me know if not and I can do bullet points to try to make it less complicated.

Thanks very much

EDIT - I have fixed the footer problem now. I just need to know how to refresh the page so it run the CSS code to align the table properly.


Refresh page with android mobile back button

Posted: Tue Mar 25, 2014 2:46 pm
by Maryna Brodina

Hello!

Do you mean every time you return back from screen 2 to screen 1 table increases in size?


Refresh page with android mobile back button

Posted: Tue Mar 25, 2014 3:16 pm
by Mark6753445

Hi Maryna

Yes I think that's what must be happening. When I start with screen1 the table is ok and according to the css. When I go back from screen2 to screen1, the table appears to have increased in size slightly causing a vertical scroll bar.

If testing in appery test area, if i use the refresh button, it goes back to being ok.

(really pleased you understood my first post! I thought I may have confused everything!)


Refresh page with android mobile back button

Posted: Tue Mar 25, 2014 3:48 pm
by Nikita

Hi Mark,

Most likely the matter is that the grid size is bigger than you set (has extra margins). So you should remove Margins for the grid (set them to 0). Or if top and bottom Margin are needed, subtract the value of these Margins when setting the height of the grid.


Refresh page with android mobile back button

Posted: Tue Mar 25, 2014 3:55 pm
by Mark6753445

Nikita

Thanks for reply. Grid is set to 100% 100% and there are no margins. This is the only way we could get the grid to centre vertically correctly,.

Thanks
Mark.


Refresh page with android mobile back button

Posted: Wed Mar 26, 2014 12:37 am
by Alena Prykhodko

Hi Mark.

The code should be executed every time you visit the page as you use "page show" event.

To ensure please add "console.log('Page show event fired')" above your code.

Also please try these two solutions:

  1. Use following code instead of yours:

    pre
    Appery("mobilegrid_5").parent().css("height", Appery("f1bstart").height() + "px");/pre

  2. Wrap your code into onDelay function:
    pre

    var onDelay = function(){
    Appery("mobilegrid_5").parent().css("height", Appery("f1bstart").css("height"));
    };
    window.setTimeout(onDelay, 100);/pre

    If it doesn't help please provide us with your app public link.


Refresh page with android mobile back button

Posted: Wed Mar 26, 2014 7:55 am
by Mark6753445

Thanks Alena