Opened 6 years ago

Closed 6 years ago

#17173 closed defect (invalid)

error extending dojox.form.manager._mixin.js

Reported by: vtsuper Owned by: vtsuper
Priority: high Milestone: 1.9.2
Component: DojoX Form Version: 1.9.0
Keywords: Cc: bitpshr
Blocked By: Blocking:

Description

when I extend dojox.form.manager._mixin.js, firebug will prompt the following error.

"TypeError?: widget.getDescendants is not a function"

once I change the line 227 in _Mixin.js to this var widgets = array.map(widget.getChildren(), registerWidget, this);

the error seems solved.

Change History (10)

comment:1 Changed 6 years ago by dylan

Cc: bitpshr added
Milestone: tbd1.9.1
Owner: set to dylan
Priority: undecidedhigh
Status: newassigned

comment:2 Changed 6 years ago by bill

Note that getChildren() and getDescendants() do different things if there are nested widgets.

You must be mixing in _Mixin to [a superclass of] _WidgetBase, rather than [a superclass of] _Widget, hence getDescendants() is not available. I'm not sure that qualifies as a bug, rather than a limitation of _Mixin, but I guess it would be nice to eliminate the limitation.

comment:3 Changed 6 years ago by bill

Summary: extend dojox.form.manager._mixin.jserror extending dojox.form.manager._mixin.js

vtsuper - what's your test case? Is this something that worked in an earlier release?

comment:4 Changed 6 years ago by Colin Snover

Owner: changed from dylan to vtsuper
Status: assignedpending

comment:5 Changed 6 years ago by vtsuper

Status: pendingnew

here are my widget (reference http://dojo-toolkit.33424.n3.nabble.com/Templated-dojox-form-Manager-problem-tp908864.html)

define(["dojo/_base/declare", "dijit/_WidgetBase", "dijit/_TemplatedMixin","dijit/_WidgetsInTemplateMixin",
	"dojox/form/manager/_Mixin","dojox/form/manager/_ClassMixin","dojox/form/manager/_FormMixin","dojox/form/manager/_NodeMixin","dojox/form/manager/_EnableMixin","dojox/form/manager/_ValueMixin","dojox/form/manager/_DisplayMixin","dojo/text!./templates/Frm.html"
],
function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, 
	_Mixin, _ClassMixin, FormMixin, _NodeMixin, _EnableMixin, _ValueMixin, _DisplayMixin,template
){
	return declare("custom.Frm", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Mixin, _ClassMixin,FormMixin,_NodeMixin,_EnableMixin,_ValueMixin,_DisplayMixin], {
	        templateString : template,        
	});
});

Frm.html

<div style="width:100%; height:100%;">
	<h6>testing</h6>
	<form data-dojo-type="dijit/form/Form" data-dojo-attach-point="form">
		<div data-dojo-attach-point="containerNode" class="frm"></div>
	</form>
</div>

comment:6 Changed 6 years ago by vtsuper

I found some hints about this case.

this code is failed

define(["dojo/_base/declare", "dijit/_WidgetBase"..................

this code is worked

define(["dojo/_base/declare", "dijit/_Widget", "dijit/_WidgetBase"..................

according to my understanding, _Widget is deprecated and replaced by _WidgetBase soon. So I extend from _WidgetBase directly, but _WidgetBase seems hasn't got "getDescendants" method that dojox.form.manager was called.

so it is the problem of dojox.form.manager or _WidgetBase???

comment:7 in reply to:  6 Changed 6 years ago by bill

Replying to vtsuper:

so it is the problem of dojox.form.manager or _WidgetBase???

I'd say the problem is in your custom code. Dojox.form.manager._mixin requires that you extend _Widget, and yet you are extending _WidgetBase. Of course, that should be documented better.

It's true that we planned to eventually replace _Widget by _WidgetBase, but that doesn't mean that code that depends on _Widget is broken; it just means that it hasn't been upgraded yet.

comment:8 Changed 6 years ago by vtsuper

then it is not a bug, I misunderstand the document. _WidgetBase will be replace _Widget soon, but not now. And we should extend _Widget, and _WidgetBase at this moment.

sorry about that. this case should be closed.

Last edited 6 years ago by vtsuper (previous) (diff)

comment:9 Changed 6 years ago by Colin Snover

Milestone: 1.9.11.9.2

1.9.1 is released; moving all outstanding tickets to next milestone.

comment:10 Changed 6 years ago by bill

Resolution: invalid
Status: newclosed

OK then, closing this.

Note: See TracTickets for help on using tickets.