Try our conversational search powered by Generative AI!

episerver RestStore not initializing

Vote:
 

I have an initializer in the /clientresources/scripts/ModuleInitializer.js. for some reason, when i use this, i keep getting an error stating that the store with name 'supporteddisplayoptions' doesn't exist.  WHAT AM I MISSING.  I am trying to implement the supporteddisplayoptions i found on the web but for somereason, it is failing to register the store.

define([
    "dojo",
    "dojo/_base/declare",
    "epi/_Module",
    "epi/dependency",
    "epi/routes",
    "epi/shell/store/JsonRest"
], function (
    dojo,
    declare,
    _Module,
    dependency,
    routes,
    JsonRest
) {
    return declare([_Module], {
        initialize: function () {
            this.inherited(arguments);
            var registry = this.resolveDependency("epi.storeregistry");

            //Register the store
            registry.add("supporteddisplayoptions", this._getRestPath("supporteddisplayoptions"));
        },

        _getRestPath: function (name) {
            return routes.getRestPath({ moduleArea: "app", storeName: name });
        }
    });
});
#146510
Mar 16, 2016 20:53
Vote:
 
#146511
Mar 16, 2016 20:56
Vote:
 

Hi,

The moduleInitializer should be included in module.config. Please check if you added this:

<clientModule initializer="app.ModuleInitializer">
      <moduleDependencies>
         <add dependency="CMS" type="RunAfter" />
      </moduleDependencies>
   </clientModule>

Then you could run Developer Tools and check in Network Tab if ModuleInitializer.js is loaded.

#146607
Mar 18, 2016 17:14
Vote:
 

Good Day Grzegorz,

this is what my module config looks like.  Any help would be greatly appreciated.  Do i have somthing wrong in here.

<?xml version="1.0" encoding="utf-8"?>
<module>
  <dojo>
    <paths>
      <add name="menupin" path="Scripts/MenuPin" />
      <add name="app" path="Scripts" />
    </paths>
  </dojo>
  <clientModule initializer="menupin.MenuPinInit">
    <moduleDependencies>
      <add dependency="CMS" type="RunAfter" />
    </moduleDependencies>
    <requiredResources>
      <add name="geta-tags-vendor" />
      <add name="geta-tags-styles" />
    </requiredResources>
  </clientModule>
  <clientModule initializer="app.ModuleInitializer">
    <moduleDependencies>
      <add dependency="CMS" type="RunAfter" />
    </moduleDependencies>
  </clientModule>
  <assemblies>
    <add assembly="Geta.Tags" />
    <add assembly="MyAssembly" />
  </assemblies>
  <clientResources>
    <add name="epi-cms.widgets.base" path="Styles/Styles.css" resourceType="Style" />
    <add name="epi-cms.widgets.base" path="Scripts/widget/DisplayOptionSelector.js" resourceType="Script" />
    <add name="geta-tags-vendor" path="Geta.Tags/vendor/jquery-2.1.0.min.js" resourceType="Script" sortIndex="1" />
    <add name="geta-tags-vendor" path="Geta.Tags/vendor/jquery-ui.min.js" resourceType="Script" sortIndex="2" />
    <add name="geta-tags-vendor" path="Geta.Tags/vendor/tag-it.min.js" resourceType="Script" sortIndex="3" />
    <add name="geta-tags-styles" path="Geta.Tags/styles/jquery.tagit.css" resourceType="Style" sortIndex="1" />
    <add name="geta-tags-styles" path="Geta.Tags/styles/tagit.ui-zendesk.css" resourceType="Style" sortIndex="2" />
  </clientResources>
  <dojoModules>
    <add name="geta-tags" path="Geta.Tags" />
  </dojoModules>
</module>
#146619
Edited, Mar 19, 2016 0:15
Vote:
 

Pretty sure it is becuase i have 2 clientModule Folders.  Just curious how i can run 2 initialize methods for clientModule?  any ideas or samples.  Sorry for being a pain

#146620
Mar 19, 2016 1:45
Vote:
 

Hi,

Please check if the module was loaded - you should find it in network tab.

Network tab

For testing, you could also try to remove Menu Pin for a while and see and the module starts loading.

#146677
Mar 21, 2016 14:08
Vote:
 

Good morning Grzegorz,

It appears that when i remove the menu pin, everything works as it should.

So since i have this working without another module, is there a way to get multiple initializers going at once?

#146693
Mar 21, 2016 15:12
Vote:
 

Hi Joshua

Slightly late to the party but this post might explain why this issue occured in the first place:

http://marisks.net/2016/08/08/registering-multiple-dojo-modules/

David

#151919
Aug 10, 2016 11:36
* 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.