Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

problem with array in localstorage

Thank you very much Marina!
great, makes it faster than local storage

Having a problem saving and retrieving label and value from selectmenu.

To save value I have this, it works the value is in localstorage

Image

to set the value I have this, don't know why it doesn't work

Image

for the label I have

codevar curent_item =
Appery("chickenpizzaselectmenu").find("option:selected").text();
localStorage.setItem("curent_item", curent_item);/code

and to get I have

codeAppery("orderlabel").text(localStorage.getItem("curent_item"));/code

here is the localstorage, label doesn't show, and neither property will set

here is the order of the actions, unsure what i have done wrong?

Image

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

problem with array in localstorage

Hi Michael,

You shouldn't use:
codeAppery("chickenpizzaselectmenu")/codeand
codeAppery("orderlabel")/codebecause there are a lot of page components with such names.

Replace:
codeAppery("chickenpizzaselectmenu")/code
with
code$(this)/code

and
codeAppery("orderlabel")/code
with
code$(this).closest("[name=chickenpizzamobilegrid]").find("[dsid=orderlabel]")/code

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

problem with array in localstorage

Cheers Katya,
I got the other code from another post, your solution works great,

Have you any idea why these 2 events aren't working.

thanks again Image Image

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

problem with array in localstorage

Michael,

In what order do you use these handlers?

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

problem with array in localstorage

this is what I have,

Image

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

problem with array in localstorage

Michael,

Please share the app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a. We'll take a look.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

problem with array in localstorage

app is shared, "star pizza"

thanks Katya

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

problem with array in localstorage

Michael,

It's better to use the approach you use when filling orderlabel, since the option to set Label value via Appery UI can not be applied to the elements generated by mapping (in fact, mapping duplicates them, but with different names).

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

problem with array in localstorage

OK Katya
so for value of selectmenu to save in localstorage and then load it to the label, would this be right

save

var curent_item = $(this).find("option:visible").text();
localStorage.setItem("curent_order", curent_order);

load

$(this).closest("[name=chickenpizzamobilegrid]").find("[dsid=chickenpizzaPricelabel]")
.text(localStorage.getItem("curent_order"));

Return to “Issues”