开发者

Dojo: There are something about 'class extend'?

开发者 https://www.devze.com 2023-03-04 18:19 出处:网络
I want to make a new widget java开发者_如何学Pythonscript class [Label] it look like dijit.button.

I want to make a new widget java开发者_如何学Pythonscript class [Label] it look like dijit.button. So I look at the source code of dijit Button and try to copycat it.

It start with declare and I use dijit.form._FormWidget as a superclass.

But when I run it on the web page it doesn't work, I debug with Firebug in Firefox and it return "this.containerNode is null"

I can't figure how to set containerNode parameter.

Can anyone answer me, what the problem does it cause it to happen?

P.S. I'm a bit new to javascript.


A simple dijit for your reference. The JavaScript:

dojo.declare("com.example.Label", [dijit._Widget, dijit._Templated], {
    templateString: dojo.cache("com.example", "templates/Label.html"),
    value : ""
});

The HTML template:

<div><span>${value}</span></div>

Usage:

var label = new com.example.Label({value : "Hello"});
0

精彩评论

暂无评论...
验证码 换一张
取 消