Login Register

dojo.widget.manager

dojo.widget.manager → dijit.util.manager

dojo.require("dijit.util.manager");

Name changes

Methods
0.40.9Comments
dojo.widget.byId()dijit.byId()
dojo.widget.getWidgetsByNode()dijit.registry.byNode()
dojo.widget.getAllWidgets()dijit.registry.forEach(func)
dojo.widget.getWidgetsByType()dijit.registry.byClass()iterate over results using dijit.registry.byClass(...).forEach(func)
dojo.widget.getWidgetsByFilterdijit.registry.filter(...)iterate over results using dijit.registry.filter(...).forEach(func)

byType

I'm not clear how you'd recreate the functionality that getWidgetsByType aka byType offered - as the widgetType property seems to also be gone?

Compare the constructor maybe?
This is further complicated by getWidgets returning a hash not an array. Perhaps something like this:

function byType(widgetClass) { 
  var widgetHash = dijit.util.manager.getWidgets(); 
  var matches = [];
  for(var i in widgetHash) {
  	if(widgetHash[i].constructor === widgetClass) {
  	  matches.push(widgetHash[i]);
  	}
  }
  return matches;
}

Which might be invoked as byType(dijit.layout.ContentPane)

getWidgetsByType()

Right, it would be something like that. I could be persuaded to add in more convenience functions to dijit.util.manager, but initially left them out, since getWidgetsByType() wasn't needed anywhere within Dijit (and thus seemed doubtful that it was needed at all).

I think byType is definately worth having.

I liked byType.... used it mainly for debugging but I can see it being useful in some cases.

-Karl

dojox.debug?

I think that's a good point Karl. I use it almost exclusively during dev/debugging too. Maybe a better solution would be to put it in a feature-rich debugging module in dojox, and keep a lightweight djit core. If I find myself copying that code back over into a production module more than a couple of times then I might vote for it as a candidate for re-inclusion.

dijit.byClass and dijit.byNode

dijit.byClass doesnt seem to exist in dijit.js (with byNode and byId, but there is a dijit.WidgetSet.byClass)) and dijit.byNode only seems to work on widgets whose srcNode originally had an id... the uniqueId assigned to each widget isnt populated down to the node so byNode will work...

-Karl

byClass(), byNode()

There's a testcase for byClass(); check that. As for byNode() that's not included in the testcase but you know that you are supposed to pass it the widget's domNode, not the original source node right? Anyway if you see a bug with it please file a bug report.

Ahh ok it does work... The

Ahh ok it does work... The reason I was asking primarily is because the table up top lists the functions differently and those names dont exist... are they supposed to, or is the table wrong?

-Karl

ah

Ah I see. Hmm, I thought I had made shortcuts from dijit.byClass → dijit.registry.byClass but apparently not. Well for now I just updated the table above. Thanks.

Cannot load dijit.util.manager

Hello out there,

I have a problem to load the dijit.util.manager by dojo.require("dijit.util.manager");. Inside my dojoroot there is no directory dojo/dijit/util. I use dojo 1.1.1. Are there any changes?

I need the contentPane.setHref()-function to migrate from dojo 0.4 to dojo 1.1.1

Thanks for help

Alex

Found a workaround

I found a workaround. Now I use dijit.byNode() instead of dijit.registry.byNode() and it works.

=o)

ContentPane has a setHref

in 1.1 (and possibly since much earlier) ContentPane has a setHref method, is it not behaving as expected?