1 Reply Latest reply: Oct 5, 2009 4:43 PM by Arnout Kazemier RSS

    auto suggest using a javascript array

    Phil_W Community Member

      Hi,

       

      How would I go about using the auto suggest widget with a javascript array variable rather than a spry dataset?

       

      I have another framework which can return a list of possible matches to typed input (as a javascript array variable)  and I'd like to feed that into Spry auto suggest widget.

       

      I've got an idea of what I might have to do (i.e. convert array to spry dataset and somehow refresh the data into the auto suggest widget) but what API features could I use to achieve the end result in a few steps as necessary.

       

      Cheers

       

      Phil

        • 1. Re: auto suggest using a javascript array
          Arnout Kazemier Community Member

          Hello Phil,

           

          Spry Actually allows you to use Arrays as source for a Spry Data Set. 

          Instead of using a XML or HTML dataset just create a normal dataset.

           

          var ds = new Spry.Data.DataSet();

           

          This will create the core dataset that all datasets are build on. This 

          dataset has a method called setDataFromArray()

           

           

          do:

           

          ds.setDataFromArray();

           

          Now you can just use the AutoSuggest as it was inteded to be used.  

          Hopes this helps.