Edit Widget in Launchpad theme not closing properly

2638
3
Jump to solution
10-27-2015 06:58 AM
DavidMann1
New Contributor III

I am using a version of the Launchpad theme and would like to use the Edit Widget, however when testing the widget acts really flaky.  The most irritating issue is that when I close the Edit Widget window it doesn't end the editing mode, ie. when I click on a feature it still brings up the editor window instead of the standard popup window. When I reopen the Edit widget window, none of my templates show up.  Also, if I open the Edit widget the first time before my editable layers are turned on, the templates will never appear in the widget after I have turned the layers on.

I found this post describing a different issue with the Edit widget (Edit Widget from Web AppBuilder for ArcGIS (Developer Edition) V1.2 takes the attribute from search ... ) and loaded the fixed version of the Edit widget to no avail.

I then came across this post (Widget's callback functions in Launchpad theme not working?), leading me to believe it is an issue with the theme rather than the widget.  The onOpen and onClose functions not firing properly would seem to explain all of the issues described above.  I'm not sure exactly though how or where to implement the solution Robert proposed in that post to the Edit widget or somewhere else in the app to ensure the widget is closing properly.

Any help is appreciated.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

David,

   Yes I would recommend using the on screen widget place holder until the next release where they should have this theme issue fixed

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

David,

  You would add a postCreate function and the aspect require to the edit widgets Widget.js file:

define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/_base/html',
    'dojo/i18n!esri/nls/jsapi',
    'dojo/on',
    'dojo/query',
    'dijit/_WidgetsInTemplateMixin',
    'jimu/BaseWidget',
    'jimu/MapManager',
    'esri/dijit/editing/Editor',
    'esri/layers/FeatureLayer',
    'dojo/aspect'
  ],
  function(declare, lang, html, esriBundle, on, query, _WidgetsInTemplateMixin,
    BaseWidget, MapManager, Editor, FeatureLayer, aspect) {
    return declare([BaseWidget, _WidgetsInTemplateMixin], {
      name: 'Edit',
      baseClass: 'jimu-widget-edit',
      editor: null,
      layers: null,
      _defaultStartStr: "",
      _defaultAddPointStr: "",
      resetInfoWindow: {},
      _sharedInfoBetweenEdits: {
        editCount: 0,
        resetInfoWindow: null
      },
      
      postCreate: function () {
        /*Workaround for the LanunchPad theme not firing onClose and onOpen for the widget*/  
        if(this.appConfig.theme.name === "LaunchpadTheme"){  
          var tPanel = this.getPanel();  
          if(tPanel){  
            aspect.after(tPanel, "onClose", lang.hitch(this, this.onClose));  
            aspect.after(tPanel, "onOpen", lang.hitch(this, this.onOpen));  
          }  
        }  
        /*end work around for LaunchPad*/
      },
DavidMann1
New Contributor III

Thanks for the prompt reply, Robert.  That was the guidance I was looking for, I was confused at first because there was not a postCreate function already so I wasn't sure if it was in another file somewhere.

So I got that code added and it is behaving differently, but still not correctly.  Now when I exit the Edit widget window, the edit attributes popup no longer displays, but neither does the standard popup window, just a popup heading with no content.  Also, the shape is still in edit mode, displaying the vertices that can still be adjusted.

I'm considering just taking the widget out of the Launchpad bar and just having it on screen, as everything appears to work as expected when placed there.  Since I didn't realize until today that it was a theme issue rather than the widget itself, I hadn't tried that.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

David,

   Yes I would recommend using the on screen widget place holder until the next release where they should have this theme issue fixed

0 Kudos