Uncaught TypeError: Cannot read property 'length' of undefined!.
Stuck!
anybody can help.
Hi Romo.
In code you have an error.
Replace line of code:
pre
code
var coordsArray = obj.coordinate;
/code
/pre
With following line of code:
pre
code
var coordsArray = data;
/code
/pre
See details on screen shot: http://prntscr.com/3iqjn0/direct
Regards.
hi all,
i just wanna ask for line : var coordsArray = obj.coordinate;
for what that line ? and could you explain that ?
im so sorry, i'm newbie here
ok this solved this same issue for me. it works! thanks Katya
only question : whats the difference between using
Appery("map_name").gmap
and this :
var map = Appery("googlemap_1").options.mapElement.gmap('get', 'map');
I used the first option to place markers. the second is Yuri's code i dopnt understand the difference.
s
Hi LuisMa,
When you store object to LSV you need store there JSON string.
So click "Add js" and populate JS editor with following code: http://prntscr.com/4l0ji2/direct
pre
return = JSON.stringify(value);
/pre
2 Then when you need to use this object you can parse this string(stored in LSV) to origin JS object. Here is code:
pre
var jsonString = localStorage.getItem('pin_place');
var originObject = JSON.parse(jsonString);
//here you can access origin object in accordance to your needs:
console.log("first item = " + originObject[0]);
console.log("second item = " + originObject[1]);
/pre
Regards.
ok thank you, that makes sense.
but tried it , and it seems the Object never gets anything data from the LSV. I've attached an SS with :
-the DB showing the Geopoints,
-the console output
-the expressions watch
-and the code i inserted
also, I added this JS to the 'pin_place' mapping: "return JSON.stringify(value);"
so, supposing this code is correct, I would still need to do this :
codenew google.maps.LatLng(originObject[0],originObject[1]);/code
Instead of just:
codenew google.maps.LatLng( originObject);/code
right?
not much use for a geopoint i seems. do you recomend this approach then ? so far it has worked for me :
codevar markerLatLng=new google.maps.LatLng(
localStorage.getItem('lon') , localStorage.getItem('lat')
); /code
Hi LuisMa,
Here is code i've gave you:
pre
var jsonString = localStorage.getItem('pin_place');
var originObject = JSON.parse(jsonString);
//here you can access origin object in accordance to your needs:
console.log("first item = " + originObject[0]);
console.log("second item = " + originObject[1]);
/pre
So here is some debug code that's print information into browser console.
Could you be pleased to take a look into this console and find what this code logs?
There should be something like:
"rirst item = 45.2123"
"second item = 12.234"
pre
so, supposing this code is correct, I would still need to do this :
new google.maps.LatLng(originObject[0],originObject[1]);
/pre
Yes - it seem to be correct code. But you need to check whether you have correct values debug code.
Regards.