WAB feature actions code ???

3952
42
Jump to solution
01-02-2018 11:41 AM
CharlesBailey
New Contributor III

Where does the feature actions code go in the select widget manifest? What's wrong with this? Can someone please show me a correct sample? Thanks, cob

{
"name": "Select2",
"platform": "HTML",
"version": "2.6",
"wabVersion": "2.6",
"author": "Esri R&D Center Beijing",
"description": "",
"copyright": "",
"license": "http://www.apache.org/licenses/LICENSE-2.0",
"properties": {
"supportMultiInstance": false,

"featureActions": [{
"name": "ShowVertex",
"uri": "ShowVertexFeatureAction"
}]
}

}

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Cob,

   This is the line that causes it to only calc the first polygon (line 2, features[0]):

     onExecute: function(featureSet){
       var geometry = featureSet.features[0].geometry;

And the fact that it will not work on lines is because the you are using the GeometryService 

areasAndLengths method which is for polygons if you need to check polylines you need to use lengths method and the LengthsParameters based on your check of the geometry type.

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

View solution in original post

42 Replies
RobertScheitlin__GISP
MVP Emeritus

Cob,

  It does not go inside the properties object like you have it now:

{
  "name": "Select2",
  "platform": "HTML",
  "version": "2.6",
  "wabVersion": "2.6",
  "author": "Esri R&D Center Beijing",
  "description": "",
  "copyright": "",
  "license": "http://www.apache.org/licenses/LICENSE-2.0",
  "properties": {
    "supportMultiInstance": false
  },
  "featureActions": [{
    "name": "ShowVertex",
    "uri": "ShowVertexFeatureAction"
  }]
}
CharlesBailey
New Contributor III

It still won't work Robert - either it has no effect or the widget won't load. WHat I'm really trying to do is a calc geometry feature action on selected features, but I can't get past the first step for it to even show up in the dropdown. It worked in the demo as far as the sample widget but when I try to add it to the stemapp it won't load either.Here's the calculation feature action I'm trying to use - but as I said can't even get the first step...Thanks Robert - cob

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Cob,

   It is not going to show in the action menu if you are adding this to the manifest:

  "featureActions": [{
    "name": "ShowVertex",
    "uri": "ShowVertexFeatureAction"
  }]

It should be:

  "featureActions": [{
    "name": "CalculateGeometry",
    "uri": "CalculateGeometryAction"
  }]

Assuming you have the CalculateGeometryAction.js file in the select widget folder.

0 Kudos
CharlesBailey
New Contributor III

Right. If I wanted both would I have to have the 'featureActions' function twice? i.e.  

"featureActions": [{
"name": "ShowVertex",
"uri": "ShowVertexFeatureAction"
}],

"featureActions": [{
"name": "CalculateGeometry",
"uri": "CalculateGeometryAction"
}]

OR,

"featureActions": [{
"name": "ShowVertex",
"uri": "ShowVertexFeatureAction",

"name": "CalculateGeometry",
"uri": "CalculateGeometryAction"
}] 

?? But none of this is working - it shows nothing or won't load something with the manifest I think. Thanks, cob

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Cob,

  Yep, neither is correct.

"featureActions": [{
  "name": "ShowVertex",
  "uri": "ShowVertexFeatureAction"
}, {
  "name": "CalculateGeometry",
  "uri": "CalculateGeometryAction"
}] 

It is suppose to be an array of objects as above.

0 Kudos
CharlesBailey
New Contributor III

It just doesn't show up - the vertex count does, but not the calc meas and it's in the manifest and strings. . 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

What does the browser console say?

0 Kudos
CharlesBailey
New Contributor III

?something about not being a constructor. here is a screen shot. Thanks Robert - cob

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Cob,

   The error that says unexpected token is the real culprit. you should look at that line of code in the file indicated to find your code error.

0 Kudos