Select to view content in your preferred language

what if I need to get some information from widget.html?

1052
3
05-03-2017 11:42 AM
LindaM
by
Emerging Contributor

I created a simple widget using my own code and want to run in WAB developer Edition.

In Widget.html file, I have a dijit/form/Select as the following:

 

<select class="ControlA"

                        data-dojo-attach-point="myfirstControl"

                        data-dojo-type="dijit/form/Select">

</select>

 

In Widget.js file, I have add some values to the 'Select'; I want to get the current displayed value using the code as the following:

alert("The current selected value is  "+ this. myfirstControl.displayedValue);

But the system always indicated that it is not defined. So what if I need to get some information from my dijit/form/Select? What should I do? Thanks a lot!

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Linda,

   In your Widget.js file did you include _WidgetsInTemplateMixin?

define([
    'dojo/_base/declare',
    'dijit/_WidgetsInTemplateMixin',
...
  function (
    declare, _WidgetsInTemplateMixin,
...
return declare([BaseWidget, _WidgetsInTemplateMixin], {
LindaM
by
Emerging Contributor

Yes, I did. Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Linda,

  Then your function that needs to access this.myfirstControl is out of scope then and you need to use lang.hitch. Can you share the whole function that is accessing this.myfirstControl?

0 Kudos