Page 1 of 1

Store an item from dynamic list to local storage variable

Posted: Tue Feb 26, 2013 4:03 am
by damien

My app gets API response from facebook that returns all pages that current logged in user "likes". The responses are displayed in a list.

Example response:

id123 name1
id234 name2
id345 name3

I want the user to be able to click a response from the list and save the id to a local storage variable for use later. When I try to do this, the local storage variable always stores the last item in the list regardless of which item is selected. How can i get the local storage variable to store the selected item?


Store an item from dynamic list to local storage variable

Posted: Tue Feb 26, 2013 4:11 am
by maxkatz

How do you store the value into local storage?


Store an item from dynamic list to local storage variable

Posted: Tue Feb 26, 2013 4:26 am
by damien

does this help? i just map response to local storage variable.

Image


Store an item from dynamic list to local storage variable

Posted: Tue Feb 26, 2013 4:45 am
by maxkatz

What happens is that as you iterate over the list, each value is replaced by the next value and thus you end up with the last value in the list in local storage.

To click on an item and store it in local store, this will help: http://docs.tiggzi.com/tutorials/buil...