Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dijit/layout/ContentPane on resize end?

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!

like image 900
Steve Lam Avatar asked Jun 19 '13 04:06

Steve Lam


Video Answer


1 Answers

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);
like image 114
James Avatar answered Sep 25 '22 15:09

James