5

I am now using dojo 1.8.3 and now have a BorderContainer with 2 ContentPane on my page. I would like to listen the resize event, the code like this

dojo.ready(function(){
    dojo.connect(dijit.byId("Container"), "resize", function(changeSize, resultSize){
        // do my stuff here...
    });
});

However, is there anyway to let me know if the resize (splitting) is end? Please advice, thanks!

Danubian Sailor
  • 1
  • 38
  • 145
  • 223
Steve Lam
  • 499
  • 1
  • 10
  • 27

1 Answers1

6

First of all, I'd recommend using "modern dojo", since you're using dojo 1.8 anyway. dojo/connect is deprecated and the way to "monitor" function calls is now by using dojo/aspect.

So you'd end up with something like:

require(["dojo/ready", "dojo/aspect", "dijit/registry"], function(ready, aspect, registry) {
    ready(function() {
        aspect.after(registry.byId("Container"), "resize", function() {
            // do something after resize has been called...
        });
    });
});

If you want to have access to the arguments that have been passed to the resize function, call aspect.after with true as the last argument like:

aspect.after(registry.byId("Container"), "resize", function(changeSize, resultSize) {
    // do something with changeSize and resultSize after resize has been called...
}, true);
James
  • 11,654
  • 6
  • 52
  • 81
  • Thanks for the reply James, however, is there possible to listen the event like "onResizeEnd"? `aspect.after(registry.byId("mapContainer"), "resize", function() {}` will be triggered if I am dragging the split bar. – Steve Lam Jun 19 '13 at 09:05
  • Please correct me, but I don't think that there is something like a "resizeEnd" event. What exactly are you trying to do? Getting an "event" when the bordercontainer has layouted its children? In this case you may want to set up an after() aspect on the "_layoutChildren" method. – James Jun 19 '13 at 10:10
  • Actually, I have a content pane on the left and the other on the right, and I placed an iframe and a div "splitOverlay" on the left content pane. During dragging the splitter to left, if the mouse is hover on the iframe, I found whether I release the mouse's left button, the splitter is still in the dragging status. Finally, this code work: `dojo.ready(function(){ dojo.connect(dijit.byId("left_content_pane"), "resize", function(changeSize, resultSize){ dojo.setStyle(dojo.byId("splitOverlay"),"display","block"); }); });` However I have no way to hide the splitOverlay – Steve Lam Jun 19 '13 at 11:47