Skip to content

Instantly share code, notes, and snippets.

@phiggins42
Created August 24, 2009 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phiggins42/173827 to your computer and use it in GitHub Desktop.
Save phiggins42/173827 to your computer and use it in GitHub Desktop.
// some non-working in-theory code
dojo.declare("Tabs", dijit._Widget, {
postCreate:function(){
this.controller = dojo.create("ul");
dojo.place(this.conroller, this.domNode, "before");
this._scanChildren();
},
_scanChildren: function(){
dojo.empty(this.controller);
this.children = dojo.query("> li", this.domNode).forEach(this.addTab, this);
},
addTab: function(n){
var t = new TabChild({ linked: n, parent: this }, dojo.create("li")).placeAt(this.controller);
}
});
dojo.declare("TabChild", dijit._Widget, {
postCreate: function(){
this.connect(this.domNode, "onclick", function(e){
this.parent.children.removeClass("showing").filter(function(n){
return n == this.linked;
}, this).addClass("showing");
});
}
});
dojo.declare("TTabs", [ dijit._Widget, dijit._Templated ], {
templateString:"<div><ul dojoAttachPoint='controller'></ul><ul dojoAttachPoint='containerNode'></ul><input type='hidden' dojoAttachPoint='valueNode'></div>",
postCreate: function(){
dojo.query("> li", this.containerNode).forEach(function(n){
new TabChild({ parent:this, linker = n });
}, this);
}
});
<ul id="foo"><li>blah</li></ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment