1

I have several cmv widgets enabled, some I have built myself. All work great, but when I enable the Measurement widget I am getting this error upon loading the app:

dojo/parser::parse() error TypeError: Cannot read property 'toString' of undefined

Uncaught Error: uniqName_4: parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin. Must pre-load all supporting widgets before instantiation.

Here is my configuration:

  measure: { 
    include: true,
    id: 'measurement',
    type: 'titlePane',
    canFloat: true,
    path: 'gis/dijit/Measurement',
    title: '<i class="fa fa-share-alt fa-lg"></i> <i>&nbsp;&nbsp; Measure</i>',
    open: false,
    position: 4,
    options: {
      map: true,
      mapClickMode: true,
      defaultAreaUnit: units.ACRES,
      defaultLengthUnit: units.FEET
    }
  }

Any ideas what the problem might be?

2
  • Does this still occur when you do not include your custom widgets?
    – tmcgee
    Feb 10, 2016 at 20:17
  • I will test that. I should also mention that this error does NOT occur every time I load the app, maybe 20% of the time.
    – its30
    Feb 10, 2016 at 20:25

2 Answers 2

2

This is most likely a timing issue related to the loading of dojo module dependencies. Check your custom widgets to ensure that all the dojo dijits in the html template file are included in the modules required in your widget Javascript file. That is most often the cause.

3
  • Thanks, I checked the dojo module dependencies on my custom widgets and everything looked OK there. After further testing, although less frequent, I still get an intermittent Cannot read property 'toString' of undefined error. This error occurs without my custom widgets included in the app. Not sure what the problem is but it seems specific to the measurement widget. I will continue testing and looking for the issue.
    – its30
    Feb 11, 2016 at 14:02
  • Does this toString error affect your application? I have also seen this error intermittently. Here's one possible cause and solution: geonet.esri.com/thread/81475 Not sure if that applies to your case.
    – tmcgee
    Feb 11, 2016 at 23:31
  • I haven't found any noticeable affects with the toString error. It occurs much less frequently than the Uncaught Error: uniqName_4: parser returned unfilled promise error so I am not too concerned about it. I will check out that link though, thanks.
    – its30
    Feb 12, 2016 at 17:05
1

Having spent some time investigating this due to my own issues, it seems to be a problem with esri/dijit/Measurement itself. Just by editing the widget and commenting out the require the errors disappear (and the widget itself breaks, obviously).

This class seems to also mess with dojo's locale system during load, breaking number.parse and such. (Although it seems to fix itself by the time everything is read)

Since esri/dijit/Measurement is handled by ESRI itself, we're kinda screwed.

E: That said, applying the fix mentioned above in the comments reduces the incidence of the errors, although it doesn't seem to solve them entirely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.