4.9 Coordinate Conversion Widget - Adding to a DIV

1461
4
Jump to solution
10-17-2018 11:00 AM
AdamCrateau1
Occasional Contributor

I'm attempting to add the C.C. widget (4.9) to a container DIV in my app.  It works fine when I instantiate the widget using the default options, e.g.:

var coordsWidget = new CoordinateConversion({
   container: "coordsDiv",
   view: view
});

However, when I try to add a custom coordinate format, I get an error in dojo.js that indicates some clash in naming of DOM nodes (I think)...

When I remove the container property, and add the C.C. widget directly to the MapView.UI, using the same code for adding of the custom coordinate format, it works fine.

Any thoughts?    Attached is the full text of the error from the console for reference..

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor

I've passed this on to the devs that work on this, but a fix for now is do it like the sample does.

  coordsWidget.conversions.splice(
    0,
    0,
    new Conversion({
      format: spn
    })
  );

It seems to work as expected in that case.

Thanks!

View solution in original post

4 Replies
ReneRubalcava
Frequent Contributor

Do you have a reproducible app to look at using jsbin or codepen?

0 Kudos
AdamCrateau1
Occasional Contributor

Attached is a super simple app to illustrate the issue.   I've also created a codepen of the same.. never used this site and not sure if others can view:  4.x Coordinate Conversion - Adding to DIV 

0 Kudos
ReneRubalcava
Frequent Contributor

I've passed this on to the devs that work on this, but a fix for now is do it like the sample does.

  coordsWidget.conversions.splice(
    0,
    0,
    new Conversion({
      format: spn
    })
  );

It seems to work as expected in that case.

Thanks!

View solution in original post

AdamCrateau1
Occasional Contributor

Awesome, thank you!

0 Kudos