Been at this for hours and I can't seem to figure it out. I'm using AG-JSAPI 3.6

I have a map layout with a bordercontainer and two contentpanes, One is the map div and the other is the left div (which holds the legend, and basemaps and such as child elements).

Anyway, I have a checkbox element on the footer that when clicked, fires off a function that (should ideally) make the left div disappear and the map div expand to the width of the browser.

function toggleDiv() {
    // If statement to check if the checkbox is checked.
if (dijit.byId("ToggleLeft").checked) {
    //Sets the left div's display CSS property to inline and then setting the
    //width property
   dojo.setStyle(dijit.byId("leftDiv").domNode, 'display', 'inline');
   dojo.byId("leftDiv").style.width = '285px';

    // Sets the display css property to "none" which makes the element disappear 
   dojo.setStyle(dijit.byId("leftDiv").domNode, 'display', 'none');



The thing is, when I resize the browser, the map automatically resizes to the width of the browser. However, I want to do this as soon as the leftDiv element disappears. What js code would I have to use to get this to happen? Any help would be appreciated.


  • Have you hooked up resize event for the map? developers.arcgis.com/en/javascript/jsapi/map-amd.html#resize
    – kenbuja
    Aug 29, 2013 at 20:15
  • Hi @kenbuja. Yes, I did look into it. That doesn't seem to work either. Also, I'm not exactly sure how to implement the delay into my code. Aug 29, 2013 at 20:21
  • This does not work for me, my case: function showWidthElm(elm_div_zone_id,show) { var toggler = new dojo.fx.Toggler({ node: "leftAccordionElm"+elm_div_zone_id }); if(show==true){ toggler.show(); dijit.byId("center_panel_elm").resize(); } else{ toggler.hide(); dijit.byId("center_panel_elm").resize(); } } after close action i need to hide left accordion and show only centre region (dijitBorderContainer-child). Its hide good but don't resize. Sep 22, 2014 at 7:54
  • Welcome to GIS SE! Please note that you have written what looks like it should be a new question in the area reserved for answers. I recommend that you copy/paste the contents of this answer into a new question and then delete this answer.
    – PolyGeo
    Sep 22, 2014 at 8:15

2 Answers 2


The answer I was looking for was provided here!



  • Can you please post the contents of the answer here instead of just a link? This link no longer leads to the solution.
    – erotavlas
    Jun 28, 2017 at 13:44
  • @erotavlas I know I'm wayyy late on this, but here's a new link: community.esri.com/message/… May 30, 2018 at 15:39

Try resizing the border container as well as the map. (For me, I added a small delay to make the map redraw properly.)

//Resizes the border container

//Resizes the map after 500 ms
setTimeout(function () {        
}, 500);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.