AnsweredAssumed Answered

Alfresco.module.* is not a constructor [SOLVED]

Question asked by redraccoon on May 12, 2016
Latest reply on May 13, 2016 by redraccoon
Hello my question is really simple

I want to open a module "document-picker" when i click on my custom button in my documentLibrary in the "toolbar.js"

so, like I saw in a lot of example

<javascript> var instance = new Alfresco.module.DocumentPicker(this.id + "-linkDocumentPicker", Alfresco.ObjectRenderer); </javascript>

but I always get the error "alfresco.module.DocumentPicker is not a constructor" in the log of my browser


but as you can see this is the right constructor … by the way none of my module work by this technique (only the upload button but he is working with a fileUploadGetInstance, he is different)


<javascript>   Alfresco.module.DocumentPicker = function(htmlId, objectRendererClass)
   {
      Alfresco.module.DocumentPicker.superclass.constructor.call(this, "Alfresco.module.DocumentPicker", htmlId, ["button", "menu", "container", "resize", "datatable", "datasource"]);

      /**
       * Decoupled event listeners
       */
      this.eventGroup = htmlId;
      YAHOO.Bubbling.on("renderCurrentValue", this.onRenderCurrentValue, this);
      YAHOO.Bubbling.on("selectedItemAdded", this.onSelectedItemAdded, this);
      YAHOO.Bubbling.on("selectedItemRemoved", this.onSelectedItemRemoved, this);
      YAHOO.Bubbling.on("parentChanged", this.onParentChanged, this);
      YAHOO.Bubbling.on("parentDetails", this.onParentDetails, this);

      // Initialise prototype properties
      this.pickerId = htmlId + "-cntrl-picker";
      this.widgets = {};
      this.columns = [];
      this.currentValueMeta = [];
      this.selectedItems = [];

      //use specifed object renderer or default to default object renderer
      var objectRendererClass =  objectRendererClass || Alfresco.ObjectRenderer;
      this.options.objectRenderer = new objectRendererClass(this);

      return this;
   }; </javascript>

the picker is in my modules

Outcomes