Weird Resize Behavior

711
6
Jump to solution
11-14-2012 03:18 AM
CraigMcDade
Occasional Contributor III
I'm getting some odd behavior when I resize my map app.

If the application opens in a maximized window, I can resize to a smaller window and back to the maximized extent without any issues.

If the application opens in a window that is not maximized and I then try to maximize the window, the map does not resize and my application gets blank white space in the area that is new from the resize.

I'm not seeing any errors related to this in developer tools or firebug. My resize code is:

  dojo.connect(map, 'onLoad', function(theMap) {            //resize the map when the browser resizes            dojo.connect(dijit.byId('map'), 'resize', map,map.resize);         });         
0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor
How about if you listen to the window resize?
dojo.connect(window, 'resize', map.resize);


I changed mine from this to what you had, to listen to the dijit.byId('map') and it did not resize when I maximized in IE8, but I always just listen for the resize event of the window anyway and it's always worked for me.

It may have to do with some css as well if Kelly could not reproduce.

View solution in original post

0 Kudos
6 Replies
AndyBurns
Occasional Contributor
Looks fine.

Where are you calling this? Inside the init function? Do you have any custom CSS for map?

Also, not ment to offend but theMap - is it valid for your application and not copied from code example?

cheers
0 Kudos
CraigMcDade
Occasional Contributor III
Yes, it is from one of the samples. I thought that might be the issue and took it out, but it didn't make a difference so I just kept it in for now.

It is placed inside the init function. No custom css for map.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Hi Craig,

Just tested this issue using a sample and can't reproduce. Can you post a code sample that will allow us to reproduce the problem?
0 Kudos
ReneRubalcava
Frequent Contributor
How about if you listen to the window resize?
dojo.connect(window, 'resize', map.resize);


I changed mine from this to what you had, to listen to the dijit.byId('map') and it did not resize when I maximized in IE8, but I always just listen for the resize event of the window anyway and it's always worked for me.

It may have to do with some css as well if Kelly could not reproduce.
0 Kudos
CraigMcDade
Occasional Contributor III
Hi Craig,

Just tested this issue using a sample and can't reproduce. Can you post a code sample that will allow us to reproduce the problem?


Kelly,

I've attached my code and app. Thanks for helping

Odoe,
I tried that and am still seeing the same issue. Thanks for your help.

I've looked into the CSS and removed the CSS file altogether and the map still doesn't resize when it opens in a non maximized window.
0 Kudos
KellyHutchins
Esri Frequent Contributor
I ran a quick test with your app and I found that if I use the window's resize event (as odoe pointed out) everything works.

        
  dojo.connect(window, "resize", map, map.resize);



Try replacing the following code in your app with the code above:

dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
0 Kudos