开发者

dojo.connect VS <script type="dojo/connect"> (DojoML)

开发者 https://www.devze.com 2023-02-24 08:06 出处:网络
First of all I want to say Im new in the DOJO world and probably for some persons this question is stupid :). But also somebody says that there is no stupid questions.

First of all I want to say Im new in the DOJO world and probably for some persons this question is stupid :). But also somebody says that there is no stupid questions.

Here is my problem:

I got a quick question related to DojoML (<script type="dojo/connect"> to be more exact). In an example here: http://dojotoolkit.org/reference-guide/dijit/Tree.html we got somethin like this :

<script type="dojo/connect">

var menu = dijit.byId("tree_menu");

menu.bindDomNode(this.domNode);

dojo.connect(menu, "_openMyself", thi开发者_Go百科s, function(e) {

var tn = dijit.getEnclosingWidget(e.target); menu.getChildren().forEach(function(i) {

i.attr('disabled', !tn.item.children);

});

});

</script>

Now I would like to translate it to "traditional" script. As I read here : http://dojocampus.org/content/2008/08/09/dojoml-the-best-thing-since-sliced-bread/

such DojoML notation can be translated into :

dojo.connect(oMyTree, 'postCreate', null, function(){});

My question is if this is the right "translation" because it simply doesnt work. My goal is to attach a simple right click menu to every MyTree's node.


I have read some where i like this. This kind of scripts will run once the widget enclosing them is instantiated. Basically will append a extra handler to postCreate. But if you do you are erasing the default postCreate and running your postcreate handler.

0

精彩评论

暂无评论...
验证码 换一张
取 消