-
-
Save rmurphey/178938 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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