简体   繁体   中英

How to render Dijit widgets?

I am trying to render Dijit widgets without success. For example, I would like to create a toolbar:

var tb = new dijit.Toolbar({
});

tb.addChild(new dijit.MenuItem({
label: 'test'
}));

tb.placeAt(document.getElementById('menu'));

tb.startup();

Based on the documentation, there are no render, etc methods available. How am I supposed to render it or any other widgets?

placeAt() "renders" the widget by placing its DOM node somewhere on the page. I think you're supposed to call startup() before you do that, though.

(Incidentally, you can just pass the ID to placeAt(); the call to getElementById() is unnecessary.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM