Page 1 of 1

How to set map address property with local storage variable?

Posted: Fri Aug 17, 2012 8:21 pm
by Matthew Gann

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?


How to set map address property with local storage variable?

Posted: Fri Aug 17, 2012 10:01 pm
by maxkatz

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


How to set map address property with local storage variable?

Posted: Tue Aug 21, 2012 5:33 pm
by Matthew Gann

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?


How to set map address property with local storage variable?

Posted: Tue Aug 21, 2012 6:11 pm
by maxkatz

How to set map address property with local storage variable?

Posted: Tue Aug 28, 2012 8:00 pm
by Matthew Gann

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


How to set map address property with local storage variable?

Posted: Tue Aug 28, 2012 8:09 pm
by maxkatz

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.


How to set map address property with local storage variable?

Posted: Wed Aug 29, 2012 7:08 pm
by maxkatz

This will work:

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