Map is alway created with default size 400*400

325
3
05-29-2013 07:41 AM
tonylife
New Contributor III
Hi

When I create map using follow code, the map is always forced to be 400*400.
I tried to debug the javascript a little bit, before create map, the div has the right size 500*360, after create map, the div becomes 400*400, even I force the size in both html and javascript.
The map is created within a modal popup window using twitter bootstrap.

Please help on this.

Thanks,
Tony


[HTML]        <div style="height: 360px; overflow: auto;">
            <div style="float: left; margin-right: 5px">
                <table id="quickSearchGrid" style="vertical-align: baseline">
                </table>
                <div id="quickSearchPager">
                </div>
            </div>
            <div>
                <div id="mymap" style="width: 500px; height: 360px;"></div>
            </div>
        </div>[/HTML]

                var map = new esri.Map("mymap", {
                    basemap: "topo", 
                    slider: true,
                    height: 360,
                    width: 500,
                    zoom: 2, 
                });
0 Kudos
3 Replies
TracySchloss
Frequent Contributor
You are using parameters in your map constructor that are not valid.  If you look at the API reference, neither height or width are an option.  Have you tried it without these in your map definition?
0 Kudos
tonylife
New Contributor III
You are using parameters in your map constructor that are not valid.  If you look at the API reference, neither height or width are an option.  Have you tried it without these in your map definition?


That's a good point. I did try without width and height in createmap, only rely on size set in map div's style, it didn't work.
This map used be working correctly, after I changed the jquery UI dialog to be twitter bootstrap modal window, it stops working with right size. I don't know if anything to do with bootstrap modal window though.

Thanks,
Tony
0 Kudos
TracySchloss
Frequent Contributor
I'm not familiar with the modal popup window you're describing.  If you are calling your map to appear in some sort of popup window, wouldn't it's dimensions determine the size of the map and not the map div or the map?  Then you would want both the map div and the map to have a style of height and width of 100%?  It seems like if you specify dimension in more than one place, you're creating more potential conflict instead of trying to force the map into place.
0 Kudos