Add layer to Attribute Table using plain JavaScript

649
4
Jump to solution
03-18-2019 12:09 PM
JohnHovanec
New Contributor

I am building a custom Widget using React and am having difficulty in adding new layer information to the Attribute Table. I found the following resource: Send a layer to the Attribute Table widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS fo... but it uses a number of Dojo methods to bind the call to publishData which I am having difficulty calling from React.

Is there a way to make the call to publishData to the Attributes Table using plain JavaScript without Dojo helper methods like hitch, own, and on?

Thanks

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

John,

  Own is just a way that dojo widget clean up event handlers when a widget is destroyed. You can just not use that.

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

John,

  Hmm. I does not matter that you have chosen to use the react framework for you development the JS API still uses dojo so I am not sure why you would be having issues using and dojo classes like on or lang. Now own is a different subject as that is part of the dojo widget portion.

0 Kudos
JohnHovanec
New Contributor

Robert,

I have been able to import dojo/_base/lang with success, but I have had no success with own. I did try to import dijit/Destroyable since that seems to house own, but still ran into problems using it. I'm wondering if part of the problem is with how 'this' is referenced from within the React component versus a regular widget.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

John,

  Own is just a way that dojo widget clean up event handlers when a widget is destroyed. You can just not use that.

0 Kudos
JohnHovanec
New Contributor

Robert,

Thanks for your help. I was able to remove the own() call and then break apart the dojo version to identify the layer and the widget currently in use, and from there could call publishData on the widget.

Thanks,

John

0 Kudos