Dojo widgets always have a dom node

I am making a DataGrid with one column being a file upload column.

I was running into issues with this code because of a bad assumption on my part.  I thought the Form would not get added to the dom right away and it would not have a domNode until it was added to the page somewhere as a child.  That's not the case.  Once you construct a dijit, it has a domNode, although it may be "disconnected".  The reason I am not adding the Form to a domNode right away is that I am returning it and using it as the widget in a DataGrid using the formatter attribute.



var _form = new dijit.form.Form({
method : 'post',
enctype : 'multipart/form-data',
class : 'Uploader'
});
var _uploader = new dojox.form.Uploader(_dojoUploaderArgs);
_uploader.placeAt(_form.domNode);
_uploader._destroyOnRemove = true;

var _fileList = new dojox.form.uploader.FileList({
uploader : _uploader
});
_fileList.placeAt(_form.domNode);
_fileList._destroyOnRemove = true;

var _button = new dijit.form.Button({
type : 'submit',
label : 'Upload',
onClick : function() {
_uploader.upload();
}
});
_button.placeAt(_form.domNode);
_button._destroyOnRemove = true;

_button.startup();
_uploader.startup();
_fileList.startup();

Comments

Popular Posts