Matthew Gann
Posts: 0
Joined: Fri Aug 10, 2012 2:33 pm

How to set map address property with local storage variable?

Trying to set a map address with a local storage variable with the screen event load - Set Property - googlemap2 - Address.

That doesn't work.

So I tried custom javascript on screen event load:

var mynewaddy = localStorage.getItem('meetingTermAddress');
var map = Tiggr('googlemap2');
map.options['address'] = mynewaddy;
map.refresh();

That just makes the screen go into a never ending spin.

Thoughts?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to set map address property with local storage variable?

Does it work if you set the address directly, on line 3?

Matthew Gann
Posts: 0
Joined: Fri Aug 10, 2012 2:33 pm

How to set map address property with local storage variable?

Unfortunately, It didn't work.

What worked (which is weird) is I added a random service to the page (didn't have any relation to the page), and put the javascript above into the success event.

I think the map needed to load THEN change the variable and then refresh.

Is there something to detect if the map asset as fully loaded?

Matthew Gann
Posts: 0
Joined: Fri Aug 10, 2012 2:33 pm

How to set map address property with local storage variable?

What do you have to do within Tiggzi to add a listener and then reinitialize the map to pay attention to it?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to set map address property with local storage variable?

It's the same way you would do it in any other tool. Select the DOM element and add listener to it. You do it in JavaScript.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to set map address property with local storage variable?

This will work:

code
var address = localStorage.getItem("address");
var map = Tiggzi("googlemap1");
map.setProperty('address',_address);
map.refresh();
/code

Return to “Issues”