Crystal
Posts: 0
Joined: Mon Nov 25, 2013 8:49 am

Why can only get the first element in the array?

Hello,
I have wrotten the 3rd service by myself. When I tested the service is like this :
Image
StorePoint : the longitude and latitude

In the response area the StorePoint format is is like this :
Image

When I editing the map like this:
Image

But I can get the latitude only.

Image

So what's the reason?

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

Why can only get the first element in the array?

Hi Crystal,

You need to map a whole array. Here is an example: http://docs.appery.io/documentation/u...

Crystal
Posts: 0
Joined: Mon Nov 25, 2013 8:49 am

Why can only get the first element in the array?

Hello,
I have to map a whole array and it can display the elements.
There is another question when I click the ListItem it will go to the next page and at the same time I want save the data of this gridcell. I can save the copName,Address and Distance into the localStorage but I can only save the first data of the lat & lng of the localStorage. So could you help me?

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

Why can only get the first element in the array?

Hi Crystal,

How do you map now? How do you save lat & lng in localStorage?
Please post screenshots.

Crystal
Posts: 0
Joined: Mon Nov 25, 2013 8:49 am

Why can only get the first element in the array?

Hello,
I'm sorry it took so long to reply. The map that I have changed like this:
Image

The screenshorts below is that I save lat & lng in localStorage.

Image

The test result is like this:
Image

When I click the mobilelistitem it will navigate to another page and at the same time save the store's name , store's address and the lat&lng of the store in localStorage and the page will display the store's name , store's address and the lat&lng of the store that I saved in localStorage.
Image

The store's name and address can display but the lat & lng can not. How to resolve the problem?

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

Why can only get the first element in the array?

Hi Crystal,

This is because you map an array of values 'StorePoint' as I can see in your screenshot. To save this array run this JavaScript code on List item click event:prevar arr = new Array();
$(this).find("[name=mobilelabel_15]").each(function(i){
if (i0) {
arr.push($(this).text());}
});
localStorage.setItem("storePoint",JSON.stringify(arr));/preThis will save all values of a label 'store' in a localStorage variable 'storePoint'.

Crystal
Posts: 0
Joined: Mon Nov 25, 2013 8:49 am

Why can only get the first element in the array?

Thanks! I have solved the problem.

Sean Doherty
Posts: 0
Joined: Sun Jan 12, 2014 3:47 am

Why can only get the first element in the array?

hi Crystal - I recognized some of the characters in your app and see that it is for a store in Shanghai? I live in Shanghai and am building an app with Appery. If you ever want to meet and discuss apps, let me know :-)

---Sean

Crystal
Posts: 0
Joined: Mon Nov 25, 2013 8:49 am

Why can only get the first element in the array?

Thank you very much. If I have any problems I will ask you.

Return to “Issues”