Page 2 of 3

problem with array in localstorage

Posted: Tue Oct 22, 2013 1:37 pm
by Michael4771079

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


problem with array in localstorage

Posted: Tue Oct 22, 2013 1:39 pm
by Michael4771079

problem with array in localstorage

Posted: Tue Oct 22, 2013 3:14 pm
by Kateryna Grynko

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


problem with array in localstorage

Posted: Tue Oct 22, 2013 4:09 pm
by Michael4771079

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


problem with array in localstorage

Posted: Tue Oct 22, 2013 5:28 pm
by Kateryna Grynko

Michael,

In what order do you use these handlers?


problem with array in localstorage

Posted: Tue Oct 22, 2013 5:36 pm
by Michael4771079

this is what I have,

Image


problem with array in localstorage

Posted: Tue Oct 22, 2013 6:12 pm
by Kateryna Grynko

Michael,

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


problem with array in localstorage

Posted: Tue Oct 22, 2013 6:16 pm
by Michael4771079

app is shared, "star pizza"

thanks Katya


problem with array in localstorage

Posted: Tue Oct 22, 2013 7:00 pm
by Kateryna Grynko

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).


problem with array in localstorage

Posted: Tue Oct 22, 2013 7:19 pm
by Michael4771079

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"));