AnsweredAssumed Answered

Categories Picker

Question asked by sofia on Jul 15, 2015
Hello Community,

I want to use the JavaScript Alfresco.ObjectPicker component in order to have category picker into my page dnd-upload.html.


<div class="form-field inlineable">
  <label >Catégories:</label>                      
   <div class="object-finder inlineable" id="a_default_prop_cm_categories-cntrl">                              
      <div class="current-values inlineable object-finder-items" id="b_default_prop_cm_categories-cntrl-currentValueDisplay"></div>                              
      <input type="hidden" value="" name="prop_cm_categories" id="c_default_prop_cm_categories"/>
      <div class="show-picker inlineable" id="d_default_prop_cm_categories-cntrl-itemGroupActions"><span class="yui-button yui-push-button" id="yui-gen7"><span class="first-child"><button type="button" tabindex="0" id="yui-gen7-button" >Sélectionner</button></span></span></div>                           
      <script type="text/javascript"> //<![CDATA[
      (function(){
               var picker = new Alfresco.ObjectFinder("a_default_prop_cm_categories-cntrl", "c_default_prop_cm_categories").setOptions(
               {                                           
                 field: "prop_cm_categories",
                 compactMode: true,
                 mandatory: false,
                 currentValue: "",                                                                                      
                 selectActionLabel: "Sélectionner",
                 minSearchTermLength: 1,
                 maxSearchResults: 1000
               }).setMessages(
                 {""}
               );
               picker.setOptions(
               {
                 itemType: "cm:category",
                 multipleSelectMode: true,
                 parentNodeRef: "alfresco://category/root",
                 itemFamily: "category",
                 maintainAddedRemovedItems: false,
                 params: "",
                 createNewItemUri: "",
                 createNewItemIcon: ""
               });
      })();
      //]]>
      </script>                           
   </div>
</div>


And I have declared a JS dependency

<@script type="text/javascript" src="${url.context}/res/components/object-finder/object-finder.js" group="objectfinder"/>

When I click on the button : "Séléctionner" , nothing happens and I have no console error neither.

Do you , Please, have any idea about how to make this Picker Working ?

Regards,
Sofia.

Outcomes