I am creating a custom widget in ArcGIS Web AppBuilder.
This page shows how you can use the WidgetManager to close a widget programmatically, saving the user from having to click the X button manually.
The difference between the example code given on the above page and the code in my widget is I have a declare
portion of my class like so:
define(['dojo/_base/declare', 'jimu/BaseWidget', 'jimu/WidgetManager', 'dojo/dom-style'],
function(declare, BaseWidget, WidgetManager, style) {
return declare([BaseWidget], {
....
});
});
Within an onClick function in the above, I attempt to call WidgetManager.getInstance.closeWidget(this.id)
, as recommended by the code sample on the ESRI page. This does not work, and the failure is silent.
I'm a Dojo/Web AppBuilder newbie, but I vaguely understand that declare
creates a new instance of a class, whereas the ESRI website seems to be using WidgetManager
in a more abstract way. Does this have anything to do with it?