AnsweredAssumed Answered

Javascrip. Autocompete with YAHOO library.

Question asked by paolatco on Mar 15, 2012
Latest reply on Oct 16, 2014 by pablog.
Hello, i'm posting the english version for this post (https://forums.alfresco.com/es/viewtopic.php?f=11&t=3993)

Hello. I'm extending Alfresco Share… I already have a custom page for my Share, and it's based on data-list, create form and another that i found on internet. Their javascript code have references to Yahoo YUI library. I am trying to add autocomplete functionality but it's not working, can someone help me a little bit?. Thank you very much.
I send my javascript code that i have.


    /*
    *** Areas Tematicas
    *
    *
    *
    *
    */


    (function()
    {
       /**
        * YUI Library aliases
        */
       var Dom = YAHOO.util.Dom,
          Event = YAHOO.util.Event;

       /**
        * Alfresco Slingshot aliases
        */
       var $html = Alfresco.util.encodeHTML;

       /**
        * Alfresco.AreasTematicas constructor.
        * @return {Alfresco.AreasTematicas} the new component instance
        * @constructor
        */
      
       Alfresco.component.AreasTematicas = function (htmlId)
       {
      
          this.name = "Alfresco.component.AreasTematicas";
          this.id = htmlId;
        
          /* Register this component */
          Alfresco.util.ComponentManager.register(this);
        
          /* Load YUI Components */
          //Alfresco.util.YUILoaderHelper.require(["calendar", "button"], this.onComponentsLoaded, this);
        
         Alfresco.component.AreasTematicas.superclass.constructor.call(this, "Alfresco.component.AreasTematicas", htmlId);

         //Evento encontrar areas tematicas
          YAHOO.Bubbling.on("areasTematicas", this.jsAreasTematicas, this);
      
          return this;
       };  

    

       YAHOO.extend(Alfresco.component.AreasTematicas, Alfresco.component.Base,
       {
          /**
          * Object container for initialization options
          *
          * @property options
          * @type object
          */
          options:
          {
              /**
               * Current siteId.
               *
               * @property siteId
               * @type string
               */
              siteId: ""
          },
      
          onReady: function AutoReadme_onReady()
          {
             this.jsAreasTematicas
              // No action required here.
          },

       
       
       
          jsAreasTematicas: AreasTematicas_jsAreasTematicas function() {

             YAHOO.example.Data = {
                arrayStates: [
                "Alabama",
                "Alaska",
                "Arizona",
                "Arkansas"
                ]
             };

             this.oDS = new YAHOO.util.LocalDataSource
             (YAHOO.example.Data.arrayStates);
             this.oDS.responseSchema = {fields : ["state"]};

             this.oAC = new YAHOO.widget.AutoComplete(this.id + "myInput", this.id + "myContainer",    this.oDS);
             //this.oAC.prehighlightClassName = "yui-ac-prehighlight";
             this.oAC.useShadow = true;

             return {
                oDS: this.oDS,
                oAC: this.oAC
             };
          }

      
       });

      
    })();


        


Outcomes