javascript - Replacement for deprecated dijit/_Widget.getDescendants function? -


i using dojo 1.9.1 , lodash.compat 1.3.1.

i attempting replace deprecated dijit/_widget.getdescendants() function. deprecation warning says use getchildren() instead, not recurse.

this have far. works fine in chrome , firefox, results in unhelpful [object error] in ie7.

function get_widget_descendants(parent_widget) {     return _(query("[widgetid]", parent_widget.domnode))     .map(registry.bynode)     .value(); } 

here jsfiddle demonstrating how it's supposed work (i don't think jsfiddle works in ie7 though, kind of does, see this).

update: actually, lodash doesn't pass tests under ie7. never mind that, lodash.compat build does. compat build still has same problem.

does have ideas how working under ie7? has solved problem already?

based on fiddle, looks looking form widgets children of widget.

dojox/form/manager has method called inspectformwidgets lookiing for.

dijit/form/formmixin has method can reuse:

_getdescendantformwidgets: function(/*dijit/_widgetbase[]?*/ children){     var res = [];     array.foreach(children || this.getchildren(), function(child){         if("value" in child){             res.push(child);         }else{             res = res.concat(this._getdescendantformwidgets(child.getchildren()));         }     }, this);     return res; }, 

you can call using following

require(['dijit/form/_formmixin'], function(dijitformmixin) {      var widget = ...      var descendants = dijitformmixin.prototype._getdescendantformwidgets.call(         widget, widget.getchildren()); }); 

if need more form widgets can create function similar _getdescendantformwidgets.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -