Page 1 of 2

Renavigate back to page not working after filling dropdown

Posted: Mon Dec 08, 2014 11:56 pm
by Aeneas McBurney

Hi, I have a strange issue in that when I navigate to a page and the pageload event runs the below code to fill a dropdown and then leave that page I am unable to navigate back to it? It just freezes the application.

The code on pageload is....

var detsarr=localStorage.getItem('horseDetails');
var obj = JSON.parse(detsarr);
var horseID=localStorage.getItem('currentHorseID');
var dropDown = Appery("selectInCompany");
dropDown.empty();
alert('empty');

for (var i=0; i < obj.length; i++) { // loop through the array
if (obj._id != horseID){
dropDown.append($('' +obj.name +''));
}

}

dropDown.selectmenu("refresh");
alert('refresh');

If I remove this code it I can renavigate back as normal.


Renavigate back to page not working after filling dropdown

Posted: Tue Dec 09, 2014 3:54 am
by Yurii Orishchuk

Hi Aeneas,

It seems you have error in this code. So you make parse processing that could cause an error.

Please try to wrap this line of code into try catch:

precode

var detsarr = localStorage&#46;getItem('horseDetails');

try{
var obj = JSON&#46;parse(detsarr);
}
catch(e){
console&#46;log("error in parsing detsaar, use default empty array");
var obj = [];
};

var horseID = localStorage&#46;getItem('currentHorseID');
var dropDown = Appery("selectInCompany");

dropDown&#46;empty();

for (var i = 0; i < obj&#46;length; i++) { &#47;&#47; loop through the array
if (obj&#46;_id != horseID) {
&#47;&#47;This line of code is not correct(changed with get satisfation - you should use your one)
dropDown&#46;append($('<option>' + obj&#46;name + '</option>'));
}

};

dropDown&#46;selectmenu("refresh");

/code/pre

Regards.


Renavigate back to page not working after filling dropdown

Posted: Tue Dec 09, 2014 4:31 am
by Aeneas McBurney

This code makes no difference and there is no error being thrown in the catch. The actual drop down gets populated correctly but when I leave the page I cannot renavigate back to it after I run this code??


Renavigate back to page not working after filling dropdown

Posted: Tue Dec 09, 2014 5:39 am
by Yurii Orishchuk

Aeneas,

Problem probably in error on your page that prevent to load page.

Please give us your app public link and describe steps to reproduce this problem.

Regards.


Renavigate back to page not working after filling dropdown

Posted: Tue Dec 09, 2014 5:49 am
by Aeneas McBurney

No probs, how do I give you my public link?


Renavigate back to page not working after filling dropdown

Posted: Tue Dec 09, 2014 6:00 am
by Yurii Orishchuk

Aeneas,

Here is screen shot about how you can get public link from your project:

http://prntscr.com/5et8eb/direct

Regards.


Renavigate back to page not working after filling dropdown

Posted: Tue Dec 09, 2014 6:08 am
by Aeneas McBurney

Great thanks. Public link is

http://appery.io/app/view/bea405ad-0a...

If you login as test/test and then choose 'Workouts" screen which will then run the code to populate the dropdown. The dropdown is shown by selecting the "In Company?" toggle button. If you then go back to previous screen and try going into Workouts again it doesn't work. Please ignore the alerts as I was using them for debugging purposes.


Renavigate back to page not working after filling dropdown

Posted: Wed Dec 10, 2014 5:50 am
by Yurii Orishchuk

Hi Aeneas,

Can not find a way to choose 'Workouts" screen
Details: http://prntscr.com/5f5str/direct

Please make screen shot to clarify it.

Regards.


Renavigate back to page not working after filling dropdown

Posted: Wed Dec 10, 2014 6:05 am
by Aeneas McBurney

Hi, you need to login first from the startScreen first using test/test.

http://appery.io/app/view/bea405ad-0a...


Renavigate back to page not working after filling dropdown

Posted: Thu Dec 11, 2014 10:12 pm
by Yurii Orishchuk

Hi Aeneas,

That's exactly what i do.

Login with test/test. http://prntscr.com/5ff4t9/direct
After login immediatelly i have this page: http://prntscr.com/5ff565/direct
Regards.