0

I think I'm missing something obvious here in Dojo 1.8 w.r.t. writing custom widgets.

I have a simple widget that includes, among other things, a currencyTextBox.

At runtime, I would like to be able to change the currency of that widget to USD or EUR or whatever else.

Normally, if this wasn't a widget, I could do that simply with

registry.byId("myCurrentTextBox").set("currency","USD");

But nested widgets inside of custom widgets don't get registered in the registry. So, what's the trick to getting addressability to the widget and assigning widget attributes (not just DOM attributes) for a widget nested inside a custom widget?

2 Answers2

0

Add data-dojo-attach-point="myCurrentTextBox" to the widget definition in the template. Then from within the widget you can access the textbox using this.myCurrentTextBox.

Craig Swing
  • 8,112
  • 2
  • 28
  • 43
0

As far as I know, all widgets are added to the registry. Maybe the id is wrong? I guess by 'registry' it mean you required 'dijit/registry' ? Did you try with registry.byNode?

ben
  • 3,507
  • 1
  • 12
  • 27