Page 1 of 1

Local Storage is storing only the last value in my listview - i need the selected one?

Posted: Sun Jun 09, 2013 8:44 pm
by John Herdean

Hi,

I am trying to store the selected value of an id into local storage so that when the user goes to the next screen it can request the respective record, however it seems that its storing only the last record id in the list. Im not sure what i did wrong.

I first tried to store the localSTorageItem by this code:

var load_id = Appery("mobilelistitem_515").load_id();
localSTorage.setItem("driver_active_load_id", load_id);

Image

and on the other side I mapped the item to the request parameter with the following JS:

var load_id = localStorage.getItem("driver_active_load_id");

Since that JS code didnt work i thought maybe i had to map the list item to the local storage item:

Image

with all that code and mapping all it did is just store the last record in the list.


Local Storage is storing only the last value in my listview - i need the selected one?

Posted: Sun Jun 09, 2013 8:48 pm
by John Herdean

so im thinking that mapping the response in the local storage item as shown in my 2nd pic is wrong. And probably my setting the value JS code is maybe wrong:

var load_id = Appery("mobilelistitem_515").load_id();
localSTorage.setItem("driver_active_load_id", load_id);

If i remove the mapping as shown in pic 2, then the above code would be the only thing remaining that should do the trick, but its not. Is my techniques and codes correct here?


Local Storage is storing only the last value in my listview - i need the selected one?

Posted: Sun Jun 09, 2013 10:13 pm
by maxkatz

This tutorial shows how to do that: http://docs.appery.io/tutorials/build...


Local Storage is storing only the last value in my listview - i need the selected one?

Posted: Sun Jun 09, 2013 11:36 pm
by John Herdean

ok thanks for that link. Sometimes I cant even find those tutorials even when i search for those keywords..

Ok, I tried to do exacty as the tutorial explains and i still get the last record. Somehow its storing the last record in the list, not the selected one. Heres how i did it:

Image


Local Storage is storing only the last value in my listview - i need the selected one?

Posted: Sun Jun 09, 2013 11:47 pm
by John Herdean

sorry about it.. i now see what i missed. I forgot to create an invisible label as a temp storage item


Local Storage is storing only the last value in my listview - i need the selected one?

Posted: Sun Jun 09, 2013 11:47 pm
by John Herdean

it now works