November Happy Hour will be moved to Thursday December 5th.

Issue with Custom DOJO editor

Vote:
 

Hello team, 

I hope to get some inputs on the folllowing issue I have.

We have created a custom editor and below is the code structure. This basically creates a dropdown element and then shows/hides few properties based on dropdown selection.

define([
  // dojo core
  'dojo/_base/declare', // Used to declare the actual widget
  'dojo/_base/lang',
  'dojo/dom-style',
  'dojo/on', // To connect events

  // Optimizely
  'epi/shell/widget/FormContainer', // Opti base widget to extend
], function (declare, lang, domStyle, on, FormContainer) {
  const DEFAULT= 0;
  const OPTION_1 = 1;
  const OPTION_2 = 2;

  return declare('myapp.editors.customNavigation', [FormContainer], {
    widgetsList: {},

    _onFormCreated: function () {
      this.inherited(arguments);
      this._bindContentAreaEvent();
    },

    onFieldCreated: function (fieldName, widget) {
      this.inherited(arguments);
      this.widgetsList[fieldName] = widget;
    },

    _bindContentAreaEvent: function () {
      // Widgets
      var contentAreaWidget = this.widgetsList['navigationItems'];
      var siteNavigationTypeWidget = this.widgetsList['navigationType'];
      var topLevelLinksWidget = this.widgetsList['topLevelLinks'];
      var menuDirectionWidget = this.widgetsList['menuDirection'];

      // Setup on page load
      if (!siteNavigationTypeWidget.value || siteNavigationTypeWidget.value == DEFAULT) {
        this._setWidgetDisplays(contentAreaWidget, topLevelLinksWidget, menuDirectionWidget);
      } else if (siteNavigationTypeWidget.value === OPTION_1) {
        this._setWidgetDisplays(topLevelLinksWidget, contentAreaWidget, menuDirectionWidget);
      } else if (siteNavigationTypeWidget.value === OPTION_2) {
        this._setWidgetDisplays(menuDirectionWidget, topLevelLinksWidget, contentAreaWidget);
      }

      // Bind event
      this.own(
        siteNavigationTypeWidget.on(
          'change',
          lang.hitch(this, function (value) {
            if (!value || value == CONTENT_AREA) {
              this._setWidgetDisplays(contentAreaWidget, topLevelLinksWidget, menuDirectionWidget);
            } else if (value === TOP_LEVEL_LINKS) {
              this._setWidgetDisplays(topLevelLinksWidget, contentAreaWidget, menuDirectionWidget);
            } else if (value === CURRENT_CONTENT) {
              this._setWidgetDisplays(menuDirectionWidget, topLevelLinksWidget, contentAreaWidget);
            }
          }),
        ),
      );
    },

    _setWidgetDisplays: function (widgetToShow, ...widgetsToHide) {
      domStyle.set(widgetToShow.domNode.parentElement, 'display', 'block');
      widgetsToHide.forEach((node) => domStyle.set(node.domNode.parentElement, 'display', 'none'));
    },
  });
});

I have all related registrations done in code. When I run my applicaiton which is deployed on local IIS , eveyrthing works fine. When this is pushed on Integration, this functionality doesn't work, I see that onFormCreated never gets invoked and thus when any selection is made, it doesn't show/hide properteis and Publish button won't be enabled.

Trying to understand what could be wrong here as I don't see any issue in local environment.

Thanks in Advance

#288533
Oct 03, 2022 2:24
Vote:
 

Just a question.  Do you have your casing right?  Since I seen you said you deploy to integration, linux is case sensative.  Also, where are your clientresources located in your project?

#288570
Oct 03, 2022 19:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.