widget action sometimes does not trigger for supported features

421
15
07-18-2017 01:16 PM
StahlyEngineering
New Contributor III

I've created a custom widget that should execute a feature action for a specific feature class, checked for by the display field name.

When the widget is first added to a web app, everything works well. However if the app is saved and reloaded the feature action does not come up.

Are there specific locations where I should look for mismatched file names or something similar?

The browser (up to date Chrome) console does not report of any errors when attempting to add the widget to an app or selecting the target feature class.

(edit):

Doing any changes to the feature action .js file, including changing a comment or whitespace, saving the file and reloading the app allows the widget to work as intended until the app is reloaded again.

Thanks!

0 Kudos
15 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Stahly,

   It sounds like you are doing some work postCreate that needs to be moved to the startup method instead.

0 Kudos
StahlyEngineering
New Contributor III

The process that isn't happening is a feature action, I'm using neither postCreate nor startup. This widget is a modified version of another widget (the one parsing parcel ID's I asked about previously) that appears to work flawlessly. mismatched file and function names trigger actual errors, so I'm confident that isn't the case.

The symptom here, where the widget works after the feature action .js file is saved but only until the web app is loaded again, seem like a sort "versioning" issue where either our server that hosts the web app or something on ESRI's side ignores the feature action .js file unless it has some sort of "newly updated" flag.

I apologize for not being more specific as this behavior is not something I've seen before and do not know how to correctly identify it.

I've filed a case with tech support, and the representative went through the workflow with me via screen sharing and was equally baffled by this behavior.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Stahly,

   OK, it did not catch that initially. That is strange behavior you are describing. Do you see any errors in the console? Have you tried logging to the console in the isFeatureSupported to see if it is getting called when you are not seeing the action available?

0 Kudos
StahlyEngineering
New Contributor III

isFeatureSupported is only getting called during the first load after save, not afterwards.

I am getting the following warning in the console referring to init.js:

Use of getAttributeNode() is deprecated. Use getAttribute() instead.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

At is strange. I have not seen that issue.

0 Kudos
StahlyEngineering
New Contributor III

console error upon launching the web app after inserting the widget

I've rebuilt the widget using the barebones template rather than the fully built 'Demo' widget and incorporated the feature action.

The widget can be added to the app fine, and works during that instance as intended. However when loading the app again I get the above error and the app does not load.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Where do you define the name/label of your feature action in your code?

I always put mine in the strings.js like this:

_featureAction_eShowStatistics: "Statistics...",

The first part _featureAction_ is important.

0 Kudos
StahlyEngineering
New Contributor III

as such:

_featureAction_TSRecords: "Pull Township Documents"

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Strange  normally when I see the en-US error it has to do with the feature action label not being found.

Is TSRecords the name of your action js file?

0 Kudos