Created
August 28, 2012 11:54
-
-
Save gabriel403/3497500 to your computer and use it in GitHub Desktop.
Creating a label for a dojo widget
This file contains hidden or 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
var container = domConstruct.create("div", {'id':'TreeEditContainer'}, win.body()); | |
var form = new Form().placeAt(container); | |
var langSelect = new Select({ | |
name: "LanguageSelect", | |
options: [ | |
{ label: "en_gb", value: "en_gb" } | |
] | |
}); | |
var label = new Label({'widget':langSelect,'container':form, 'label':'Some label'}); | |
label.makelabel(); | |
define(["dojo/_base/declare", "dojo/_base/lang", "dojo/dom-construct"], function(declare, lang, domConstruct){ | |
return declare([ ], { | |
constructor: function(props) { | |
lang.mixin(this, props); | |
}, | |
widget: null, | |
container: null, | |
label: null, | |
subcontainerType: 'div', | |
subcontainer: null, | |
makelabel: function(){ | |
this.subcontainer = domConstruct.create(this.subcontainerType, {}, this.container.id); | |
domConstruct.create("label", {"for": this.widget.id, 'innerHTML': this.label}, this.subcontainer); | |
this.widget.placeAt(this.subcontainer); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment