RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Pushing an object into an array of objects overwrites prior objects

I'm having a problem pushing an object into an array of objects... each successive push overwrites the prior objects pushed into the array.

Here's my first object (note the city name):

http://screencast.com/t/Mg36j5tl3

And here's the array after the object was pushed into it:

http://screencast.com/t/cQI6AcXzedkB

Here's my second object (note the different city name):

http://screencast.com/t/QQW0Def2nXS

And here's the array after the push. Notice how both objects are the same - i.e. equaling the second object.

http://screencast.com/t/sGlieGGoP

And here is the incorrect resulting list. Note that the picture shows three items even though I just talked above about two. Don't be concerned about that.

http://screencast.com/t/XrV21Oz466vn

Here is my code. It is the first item for the service success event.
http://screencast.com/t/TJjq9Zt9u

Thanks very much.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Pushing an object into an array of objects overwrites prior objects

Hello,

Please send us JS that you use for pushing data.

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Pushing an object into an array of objects overwrites prior objects

Thank you Sergiy. The code has been sent to support.

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Pushing an object into an array of objects overwrites prior objects

UPDATE: Sergiy fixed it with the following solution. I would never have found that on my own. Thanks a million Sergiy for your prompt and great support.

Please declarate variable BlockRecord inside of for() loop.

If you need just to save service response data into storage variable, use simple JS:
Apperyio.storage.L_EsriidList.set(data);

Return to “Issues”