Select to view content in your preferred language

getting started, require-function

3157
4
Jump to solution
07-08-2015 01:22 AM
georgandersson
Emerging Contributor

hi

attached a simple example of how to initialize a map und wire up an Event handler. this works fine.

now, i have to adapt this code to initialize a map in a div, that isn't accessible at the time of the initial load of the page. the whole map-initialization und eventhandler-wiring would need to be placed in a function, that can be accessed at runtime.

how would i do that? all i tried so far was poor...

regards

0 Kudos
1 Solution

Accepted Solutions
JoshHevenor
Frequent Contributor

I may have missunderstood. Here's a sample of how to create the div and map from scratch after the page is loaded:

Edit fiddle - JSFiddle

View solution in original post

4 Replies
JoshHevenor
Frequent Contributor
0 Kudos
TimWitt2
MVP Alum
As Josh has mentioned add "dojo/domReady!" as your last require. I would also add "dojo/parser" as seen here. And as your first line user parser.parse() which can be seen in the link under "running the parser".
0 Kudos
georgandersson
Emerging Contributor

i'm not shure, if domReady solves this. i'm using asp.net to create an aspx-page that loads several ascx-controls depending on the users interaction. only if one specific button gets hit, the control holding the map-div is loaded. so during the initial loading of the page, the div is never accessible...

0 Kudos
JoshHevenor
Frequent Contributor

I may have missunderstood. Here's a sample of how to create the div and map from scratch after the page is loaded:

Edit fiddle - JSFiddle