Page 1 of 3

selectmenu undefined when mapped from localstorage

Posted: Fri Jan 23, 2015 4:12 pm
by Michael4771079

Hi,
I have a service where I created a modelstorage and the selectmenu is comming on the screen as undefined.

I am including some screenshots it may help to discover what mistake I have made.

Here is the collection,
modelstorage,
mapping to localstorage
result in localstorage,
mapping to page, the js used in mapping for selectmenu and the result is undefined, the mapping js is from the old builder, without the js nothing shows on the screen.

Does this js need to be altered for the new builder?
Or is ther something else wrong with this setup?

there are no errors in console

If theres anything else I can show you please ask

thanks

Image

Image

Image

Image

Image

Image

js used in mapping to selectmenu

codefunction strRepresentationToObject(str) {
str = str.slice(1, -1);
var i, len, obj={}, tmp, arr = str.split(', ');
for (i = 0, len = arr&#46;length; i < len; i++) {
tmp = arr&#46;split('=');
obj[tmp[0]] = tmp[1];
}
return obj;
}
var valuesArray;
try {
valuesArray = JSON&#46;parse(value);
if ({}&#46;toString&#46;call(valuesArray) !== "[object Array]") {
valuesArray = [];
}
} catch ( e ) {
valuesArray = [];
}
var i, len, obj, $element = $(element);
$element&#46;empty();
for (var i = 0, len = value&#46;length; i < len; i++) {
obj =strRepresentationToObject(value);
$element&#46;append('<option rerender="chickenpizzaselectmenu" value="' + obj['price'] + '">' + obj['size'] + '</option>');
}
return true;/code

Image


selectmenu undefined when mapped from localstorage

Posted: Fri Jan 23, 2015 6:13 pm
by Michael4771079

Hi something I forgot,
not sure if its revelant, the following js is static in the app

codefunction save(item, varName) {
try {
var arr = JSON&#46;parse(localStorage&#46;getItem(varName));
if ({}&#46;toString&#46;call(arr) !== "[object Array]") {
arr = [];
}
} catch ( e ) {
arr = [];
}
arr&#46;push(item);
localStorage&#46;setItem(varName, JSON&#46;stringify(arr));
}

function myload(varName) {
try {
var arr = JSON&#46;parse(localStorage&#46;getItem(varName));
if ({}&#46;toString&#46;call(arr) !== "[object Array]") {
arr = [];
}
} catch ( e ) {
arr = [];
}
}
/code

thanks


selectmenu undefined when mapped from localstorage

Posted: Sat Jan 24, 2015 8:28 pm
by Illya Stepanov

Hi Michael -

As I assume this issue is related to your app "anglo pizza", am I correct?

We are working on it, and we will post an update when we get some news from our developers.


selectmenu undefined when mapped from localstorage

Posted: Sat Jan 24, 2015 11:34 pm
by Michael4771079

Ok lllya,
thanks for that,
yes this issue is another issue from anglo upgrade,
I raised it as time is running short, and until I can advance I dont know what other problems I may uncover.

thanks for the reply


selectmenu undefined when mapped from localstorage

Posted: Mon Jan 26, 2015 12:15 pm
by Michael4771079

I forgot to mention
once logged in to app (use "a" as login and pass)
click new order btn
from menu click pizza
then click vegetarian pizza

in builder the page name is "anglovegpizza"

result has changed somehow, maybe another tweak your end,
mapping is still the same but the selectmenu is completely empty

Image


selectmenu undefined when mapped from localstorage

Posted: Wed Jan 28, 2015 9:17 am
by Evgene Karachevtsev

Hello Michael,

We managed to reproduce this and are working on it.


selectmenu undefined when mapped from localstorage

Posted: Wed Jan 28, 2015 10:50 am
by Michael4771079

Thanks for telling me Evegene


selectmenu undefined when mapped from localstorage

Posted: Sat Jan 31, 2015 6:27 pm
by Alena Prykhodko

Hello,

1) You need to use mapping instead of your JavaScript code. You copy and paste new objects incorrect.

2) code return true;/code

Returning value should be a number

3) Add after first mapping for this service JavaScript code that saves properly value and name to the LSV, don't forget to create those fields in LSV at storage and models, and then use this LSV in second mapping, it will be much easier, than cloning templates tags and append them in right place at the page.


selectmenu undefined when mapped from localstorage

Posted: Sun Feb 01, 2015 4:00 pm
by Michael4771079

Hi,
Im sorry I really dont understand your awnser.
The sizeandprice array is in the Json in localstorage
I just need to map it to the selectmenu.
I need to keep the app logic that already exists

Is there an example or docs about mapping an array from a Json to a selectmenu in a grid?

yhanks


selectmenu undefined when mapped from localstorage

Posted: Tue Feb 03, 2015 12:41 am
by Michael4771079

This is an ugrade to new builder,
very disapointed in the level of support.
New build would be outside of your support, but update to new builder with a published app used to be alot better.

very pissed off