Skip to content

Instantly share code, notes, and snippets.

@rmurphey
Forked from phiggins42/gist:173827
Created September 1, 2009 06:24
Show Gist options
  • Save rmurphey/178938 to your computer and use it in GitHub Desktop.
Save rmurphey/178938 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