Loading ...
Sorry, an error occurred while loading the content.

Re: Help mapping response schema in Autocomplete

Expand Messages
  • kennyth01
    Thanks for the pointers satyam. Does this also mean that I will create a seperate event to just trigger the Connection Manager s asyncRequest and make it as a
    Message 1 of 20 , May 4, 2009
    • 0 Attachment
      Thanks for the pointers satyam. Does this also mean that I will create a seperate event to just trigger the Connection Manager's asyncRequest and make it as a LocalDataSource then instantiating the Autocomplete? Does this also mean that the attached event in the autocomplete will be useless?

      Regards,
      kennyth01


      --- In ydn-javascript@yahoogroups.com, <satyam@...> wrote:
      >
      >
      > Then just use Connection Manager's asyncRequest to fetch the data, change
      > it to some suitable format and use a LocalDataSource to read the processed
      > result.
      >
      > Satyam
      >
      > On Mon, 04 May 2009 13:45:29 -0000, "kennyth01" <kennyth01@...>
      > wrote:
      > > Thanks for the explanation Satyam.
      > > Yup you're right, the structure of the data is totally wrong. But is
      > there
      > > any workaround to be able to get the second array? How about getting it
      > and
      > > format it in a proper way?
      > >
      > >
      > >
      > >
      > >
      > >
      > > --- In ydn-javascript@yahoogroups.com, <satyam@> wrote:
      > >>
      > >>
      > >> As I said, that is not a proper format for what you mean. Sorry to
      > > sound
      > >> pedantic but the 'semantics' of your message is wrong. The structure of
      > >> your message does not convey the key:data relationship that you mean to
      > >> express. Both 'fruits' and the array containing the values are simple
      > >> items in an array, they are siblings, they don't have a key:values
      > >> relationship. That's why it is difficult to represent in the
      > >> responseSchema, because there is no way to express a relationship that
      > > does
      > >> not exist.
      > >>
      > >> Satyam
      > >>
      > >>
      > >> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01" <kennyth01@>
      > >> wrote:
      > >> > Thanks Satyam! I'll try this one out. But how about if I'm not using
      > >> > LocalDataSource? For example, I will use a script node:
      > >> >
      > >> > var oDS = new
      > >> >
      > >>
      > >
      > YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback&q=");
      > >> >
      > >> > and the URL gives a response of :
      > >> > myCallback(['fruits',['guava','mango','carrots']])
      > >> >
      > >> >
      > >> >
      > >> > How will I map this response to only get/display guava, mango and
      > > carrots
      > >> > on the list(autocomplete).
      > >> >
      > >> > Any idea on how is it on responseSchema? Thanks!
      > >> >
      > >> >
      > >> >
      > >> >
      > >> >
      > >> > --- In ydn-javascript@yahoogroups.com, <satyam@> wrote:
      > >> >>
      > >> >>
      > >> >>
      > >> >> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
      > >> >>
      > >> >> Hi masters,
      > >> >>
      > >> >> I have a problem getting results on an array data. Here's the
      > > snippet:
      > >> >>
      > >> >> ...
      > >> >>
      > >> >> var data = ['fruits',['guava','mango','carrots']];
      > >> >>
      > >> >> var oDS = new YAHOO.util.LocalDataSource(data);
      > >> >> You can change the line above to: var oDS = new
      > >> >> YAHOO.util.LocalDataSource(data[1]); and then forget about
      > > resultsList.
      > >> >> However,I think that what you want in that array above is more like:
      > >> >> {'fruits':['guave','mang','carrots']} Otherwise, the second item in
      > > the
      > >> >> array has no relation whatsoever to the first element
      > >> >> Satyam
      > >> >>
      > >> >> oDS.responseType = YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
      > >> >>
      > >> >> //I believe my mapping is wrong? Help me map on this please.
      > >> >> oDS.responseSchema = {
      > >> >> resultsList: ["Fruits"],
      > >> >> fields : ["Label"]
      > >> >> };
      > >> >> oAC = new YAHOO.widget.AutoComplete("sttop", "autocompleteContainer",
      > >> >> oDS);
      > >> >> oAC.queryDelay = .5;
      > >> >>
      > >> >> //How do I format it when I only want to display are list of fruits?
      > >> >> oAC.formatResult = function(oResultItem, sQuery) {
      > >> >>
      > >> >> return "_" + oResultItem[0] + "_";
      > >> >> };
      > >> >>
      > >> >> return {
      > >> >> oDS: oDS,
      > >> >> oAC: oAC
      > >> >> };
      > >> >>
      > >> >> Hoping someone will help me on this. Thanks!
      > >> >>
      > >> >>
      > >> >>
      > >> >> Links:
      > >> >> ------
      > >> >> [1]
      > >> >>
      > >> >
      > >>
      > >
      > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
      > >> >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
      > > Delivery:
      > >> >> Digest
      > >> >> [3] mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
      > >> >> Delivery Format: Fully
      > >> >> Featured
      > >> >> [4]
      > >> >>
      > >> >
      > >>
      > >
      > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
      > >> >> [5] http://docs.yahoo.com/info/terms/
      > >> >> [6]
      > >> > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
      > >> >>
      > >> >
      > >> >
      > >> >
      > >> >
      > >> > ------------------------------------
      > >> >
      > >> > Yahoo! Groups Links
      > >> >
      > >> >
      > >> >
      > >>
      > >
      > >
      > >
      > >
      > > ------------------------------------
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      >
    • satyam@satyam.com.ar
      It is a little complicated, indeed. There is another alternative, check method doBeforeParseData in DataSource. It is function meant to be overriden, the one
      Message 2 of 20 , May 4, 2009
      • 0 Attachment
        It is a little complicated, indeed. There is another alternative, check
        method doBeforeParseData in DataSource. It is function meant to be
        overriden, the one that comes with DataSource does nothing else but return
        one of the argument it receives untouched. You may, however, touch it
        anyway you want as long as you return it in more or less the same shape.
        They are documented, both in the user guide for DataSource and in the API,
        check it out. doBeforeParseData is executed before any information is
        parsed so the responseSchema has to reflect the data structure you return
        from that function, not the one that function receives in one if its
        arguments. That function is completely synchronous, you won't need to be
        concerned about timing.

        Satyam


        On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" <kennyth01@...>
        wrote:
        > Thanks for the pointers satyam. Does this also mean that I will create a
        > seperate event to just trigger the Connection Manager's asyncRequest and
        > make it as a LocalDataSource then instantiating the Autocomplete? Does
        > this also mean that the attached event in the autocomplete will be
        > useless?
        >
        > Regards,
        > kennyth01
        >
        >
        > --- In ydn-javascript@yahoogroups.com, <satyam@...> wrote:
        >>
        >>
        >> Then just use Connection Manager's asyncRequest to fetch the data,
        > change
        >> it to some suitable format and use a LocalDataSource to read the
        > processed
        >> result.
        >>
        >> Satyam
        >>
        >> On Mon, 04 May 2009 13:45:29 -0000, "kennyth01" <kennyth01@...>
        >> wrote:
        >> > Thanks for the explanation Satyam.
        >> > Yup you're right, the structure of the data is totally wrong. But is
        >> there
        >> > any workaround to be able to get the second array? How about getting
        > it
        >> and
        >> > format it in a proper way?
        >> >
        >> >
        >> >
        >> >
        >> >
        >> >
        >> > --- In ydn-javascript@yahoogroups.com, <satyam@> wrote:
        >> >>
        >> >>
        >> >> As I said, that is not a proper format for what you mean. Sorry to
        >> > sound
        >> >> pedantic but the 'semantics' of your message is wrong. The structure
        > of
        >> >> your message does not convey the key:data relationship that you mean
        > to
        >> >> express. Both 'fruits' and the array containing the values are
        > simple
        >> >> items in an array, they are siblings, they don't have a key:values
        >> >> relationship. That's why it is difficult to represent in the
        >> >> responseSchema, because there is no way to express a relationship
        > that
        >> > does
        >> >> not exist.
        >> >>
        >> >> Satyam
        >> >>
        >> >>
        >> >> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01" <kennyth01@>
        >> >> wrote:
        >> >> > Thanks Satyam! I'll try this one out. But how about if I'm not
        > using
        >> >> > LocalDataSource? For example, I will use a script node:
        >> >> >
        >> >> > var oDS = new
        >> >> >
        >> >>
        >> >
        >>
        >
        YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback&q=");
        >> >> >
        >> >> > and the URL gives a response of :
        >> >> > myCallback(['fruits',['guava','mango','carrots']])
        >> >> >
        >> >> >
        >> >> >
        >> >> > How will I map this response to only get/display guava, mango and
        >> > carrots
        >> >> > on the list(autocomplete).
        >> >> >
        >> >> > Any idea on how is it on responseSchema? Thanks!
        >> >> >
        >> >> >
        >> >> >
        >> >> >
        >> >> >
        >> >> > --- In ydn-javascript@yahoogroups.com, <satyam@> wrote:
        >> >> >>
        >> >> >>
        >> >> >>
        >> >> >> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
        >> >> >>
        >> >> >> Hi masters,
        >> >> >>
        >> >> >> I have a problem getting results on an array data. Here's the
        >> > snippet:
        >> >> >>
        >> >> >> ...
        >> >> >>
        >> >> >> var data = ['fruits',['guava','mango','carrots']];
        >> >> >>
        >> >> >> var oDS = new YAHOO.util.LocalDataSource(data);
        >> >> >> You can change the line above to: var oDS = new
        >> >> >> YAHOO.util.LocalDataSource(data[1]); and then forget about
        >> > resultsList.
        >> >> >> However,I think that what you want in that array above is more
        > like:
        >> >> >> {'fruits':['guave','mang','carrots']} Otherwise, the second item
        > in
        >> > the
        >> >> >> array has no relation whatsoever to the first element
        >> >> >> Satyam
        >> >> >>
        >> >> >> oDS.responseType = YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
        >> >> >>
        >> >> >> //I believe my mapping is wrong? Help me map on this please.
        >> >> >> oDS.responseSchema = {
        >> >> >> resultsList: ["Fruits"],
        >> >> >> fields : ["Label"]
        >> >> >> };
        >> >> >> oAC = new YAHOO.widget.AutoComplete("sttop",
        > "autocompleteContainer",
        >> >> >> oDS);
        >> >> >> oAC.queryDelay = .5;
        >> >> >>
        >> >> >> //How do I format it when I only want to display are list of
        > fruits?
        >> >> >> oAC.formatResult = function(oResultItem, sQuery) {
        >> >> >>
        >> >> >> return "_" + oResultItem[0] + "_";
        >> >> >> };
        >> >> >>
        >> >> >> return {
        >> >> >> oDS: oDS,
        >> >> >> oAC: oAC
        >> >> >> };
        >> >> >>
        >> >> >> Hoping someone will help me on this. Thanks!
        >> >> >>
        >> >> >>
        >> >> >>
        >> >> >> Links:
        >> >> >> ------
        >> >> >> [1]
        >> >> >>
        >> >> >
        >> >>
        >> >
        >>
        >
        http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
        >> >> >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
        >> > Delivery:
        >> >> >> Digest
        >> >> >> [3]
        > mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
        >> >> >> Delivery Format: Fully
        >> >> >> Featured
        >> >> >> [4]
        >> >> >>
        >> >> >
        >> >>
        >> >
        >>
        >
        http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
        >> >> >> [5] http://docs.yahoo.com/info/terms/
        >> >> >> [6]
        >> >> >
        > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
        >> >> >>
        >> >> >
        >> >> >
        >> >> >
        >> >> >
        >> >> > ------------------------------------
        >> >> >
        >> >> > Yahoo! Groups Links
        >> >> >
        >> >> >
        >> >> >
        >> >>
        >> >
        >> >
        >> >
        >> >
        >> > ------------------------------------
        >> >
        >> > Yahoo! Groups Links
        >> >
        >> >
        >> >
        >>
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
      • kennyth01
        Hi satyam, I d try overriding doBeforeParseData and it seems to work fine (using Yahoo URL as the data source). But why is that it doesn t work when using
        Message 3 of 20 , May 5, 2009
        • 0 Attachment
          Hi satyam,

          I'd try overriding doBeforeParseData and it seems to work fine (using Yahoo  URL as the data source). But why is that it doesn't work when using other data source feeds? One example is if I use this url feed:
          http://ss.ask.com/query?fn=myCallback&sstype=prefix&q=

          Here's my sample snippet:

          //Commented out.
          //var _yahooDemo = "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json&query=";

          var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix&q=";
          var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
          var  oAC = new YAHOO.widget.AutoComplete("myTextbox", "autocompleteContainer", oDS);
          oAC.queryDelay = .5;
                  // The webservice needs additional parameters
                  oAC.generateRequest = function(sQuery) {
                      return sQuery;
                  };


              //It should pop a message alert but doesn't. It works if I change my source to _yahooDemo.
             oDS.doBeforeParseData = function( oRequest , oFullResponse , oCallback ) {
                  alert("I should see this message");
                  return oFullResponse;
              };

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

          function myCallback(oResponse) {
          //Here's my callback fn. I can get the response here.
          }



          Any ideas on this?

          Regards,
          kennyth01



          --- In ydn-javascript@yahoogroups.com, <satyam@...> wrote:
          >
          >
          > It is a little complicated, indeed. There is another alternative, check
          > method doBeforeParseData in DataSource. It is function meant to be
          > overriden, the one that comes with DataSource does nothing else but return
          > one of the argument it receives untouched. You may, however, touch it
          > anyway you want as long as you return it in more or less the same shape.
          > They are documented, both in the user guide for DataSource and in the API,
          > check it out. doBeforeParseData is executed before any information is
          > parsed so the responseSchema has to reflect the data structure you return
          > from that function, not the one that function receives in one if its
          > arguments. That function is completely synchronous, you won't need to be
          > concerned about timing.
          >
          > Satyam
          >
          >
          > On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@...
          > wrote:
          > > Thanks for the pointers satyam. Does this also mean that I will create a
          > > seperate event to just trigger the Connection Manager's asyncRequest and
          > > make it as a LocalDataSource then instantiating the Autocomplete? Does
          > > this also mean that the attached event in the autocomplete will be
          > > useless?
          > >
          > > Regards,
          > > kennyth01
          > >
          > >
          > > --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
          > >>
          > >>
          > >> Then just use Connection Manager's asyncRequest to fetch the data,
          > > change
          > >> it to some suitable format and use a LocalDataSource to read the
          > > processed
          > >> result.
          > >>
          > >> Satyam
          > >>
          > >> On Mon, 04 May 2009 13:45:29 -0000, "kennyth01" kennyth01@
          > >> wrote:
          > >> > Thanks for the explanation Satyam.
          > >> > Yup you're right, the structure of the data is totally wrong. But is
          > >> there
          > >> > any workaround to be able to get the second array? How about getting
          > > it
          > >> and
          > >> > format it in a proper way?
          > >> >
          > >> >
          > >> >
          > >> >
          > >> >
          > >> >
          > >> > --- In ydn-javascript@yahoogroups.com, <satyam@> wrote:
          > >> >>
          > >> >>
          > >> >> As I said, that is not a proper format for what you mean. Sorry to
          > >> > sound
          > >> >> pedantic but the 'semantics' of your message is wrong. The structure
          > > of
          > >> >> your message does not convey the key:data relationship that you mean
          > > to
          > >> >> express. Both 'fruits' and the array containing the values are
          > > simple
          > >> >> items in an array, they are siblings, they don't have a key:values
          > >> >> relationship. That's why it is difficult to represent in the
          > >> >> responseSchema, because there is no way to express a relationship
          > > that
          > >> > does
          > >> >> not exist.
          > >> >>
          > >> >> Satyam
          > >> >>
          > >> >>
          > >> >> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01" <kennyth01@>
          > >> >> wrote:
          > >> >> > Thanks Satyam! I'll try this one out. But how about if I'm not
          > > using
          > >> >> > LocalDataSource? For example, I will use a script node:
          > >> >> >
          > >> >> > var oDS = new
          > >> >> >
          > >> >>
          > >> >
          > >>
          > >
          > YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback&q=");
          > >> >> >
          > >> >> > and the URL gives a response of :
          > >> >> > myCallback(['fruits',['guava','mango','carrots']])
          > >> >> >
          > >> >> >
          > >> >> >
          > >> >> > How will I map this response to only get/display guava, mango and
          > >> > carrots
          > >> >> > on the list(autocomplete).
          > >> >> >
          > >> >> > Any idea on how is it on responseSchema? Thanks!
          > >> >> >
          > >> >> >
          > >> >> >
          > >> >> >
          > >> >> >
          > >> >> > --- In ydn-javascript@yahoogroups.com, <satyam@> wrote:
          > >> >> >>
          > >> >> >>
          > >> >> >>
          > >> >> >> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
          > >> >> >>
          > >> >> >> Hi masters,
          > >> >> >>
          > >> >> >> I have a problem getting results on an array data. Here's the
          > >> > snippet:
          > >> >> >>
          > >> >> >> ...
          > >> >> >>
          > >> >> >> var data = ['fruits',['guava','mango','carrots']];
          > >> >> >>
          > >> >> >> var oDS = new YAHOO.util.LocalDataSource(data);
          > >> >> >> You can change the line above to: var oDS = new
          > >> >> >> YAHOO.util.LocalDataSource(data[1]); and then forget about
          > >> > resultsList.
          > >> >> >> However,I think that what you want in that array above is more
          > > like:
          > >> >> >> {'fruits':['guave','mang','carrots']} Otherwise, the second item
          > > in
          > >> > the
          > >> >> >> array has no relation whatsoever to the first element
          > >> >> >> Satyam
          > >> >> >>
          > >> >> >> oDS.responseType = YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
          > >> >> >>
          > >> >> >> //I believe my mapping is wrong? Help me map on this please.
          > >> >> >> oDS.responseSchema = {
          > >> >> >> resultsList: ["Fruits"],
          > >> >> >> fields : ["Label"]
          > >> >> >> };
          > >> >> >> oAC = new YAHOO.widget.AutoComplete("sttop",
          > > "autocompleteContainer",
          > >> >> >> oDS);
          > >> >> >> oAC.queryDelay = .5;
          > >> >> >>
          > >> >> >> //How do I format it when I only want to display are list of
          > > fruits?
          > >> >> >> oAC.formatResult = function(oResultItem, sQuery) {
          > >> >> >>
          > >> >> >> return "_" + oResultItem[0] + "_";
          > >> >> >> };
          > >> >> >>
          > >> >> >> return {
          > >> >> >> oDS: oDS,
          > >> >> >> oAC: oAC
          > >> >> >> };
          > >> >> >>
          > >> >> >> Hoping someone will help me on this. Thanks!
          > >> >> >>
          > >> >> >>
          > >> >> >>
          > >> >> >> Links:
          > >> >> >> ------
          > >> >> >> [1]
          > >> >> >>
          > >> >> >
          > >> >>
          > >> >
          > >>
          > >
          > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
          > >> >> >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
          > >> > Delivery:
          > >> >> >> Digest
          > >> >> >> [3]
          > > mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
          > >> >> >> Delivery Format: Fully
          > >> >> >> Featured
          > >> >> >> [4]
          > >> >> >>
          > >> >> >
          > >> >>
          > >> >
          > >>
          > >
          > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
          > >> >> >> [5] http://docs.yahoo.com/info/terms/
          > >> >> >> [6]
          > >> >> >
          > > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
          > >> >> >>
          > >> >> >
          > >> >> >
          > >> >> >
          > >> >> >
          > >> >> > ------------------------------------
          > >> >> >
          > >> >> > Yahoo! Groups Links
          > >> >> >
          > >> >> >
          > >> >> >
          > >> >>
          > >> >
          > >> >
          > >> >
          > >> >
          > >> > ------------------------------------
          > >> >
          > >> > Yahoo! Groups Links
          > >> >
          > >> >
          > >> >
          > >>
          > >
          > >
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          >
        • satyam@satyam.com.ar
          It looks Ok the way it is. If you use Firefox with Firebug, in the Net or Console tabs you will see the actual request and response to your query. That might
          Message 4 of 20 , May 5, 2009
          • 0 Attachment

            It looks Ok the way it is. If you use Firefox with Firebug, in the Net or Console tabs you will see the actual request and response to your query.  That might give you a clue as to what is actually going on. 

            On Tue, 05 May 2009 12:08:05 -0000, "kennyth01" wrote:

            <!-- /* start of attachment style */ .ygrp-photo-title{ clear: both; font-size: smaller; height: 15px; overflow: hidden; text-align: center; width: 75px; } div.ygrp-photo{ background-position: center; background-repeat: no-repeat; background-color: white; border: 1px solid black; height: 62px; width: 62px; } div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited { text-decoration: none; } div.attach-table div.attach-row { clear: both; } div.attach-table div.attach-row div { float: left; /* margin: 2px;*/ } p { clear: both; padding: 15px 0 3px 0; overflow: hidden; } div.ygrp-file { width: 30px; valign: middle; } div.attach-table div.attach-row div div a { text-decoration: none; } div.attach-table div.attach-row div div span { font-weight: normal; } div.ygrp-file-title { font-weight: bold; } /* end of attachment style */ --> <!-- #ygrp-mkp{ border: 1px solid #d8d8d8; font-family: Arial; margin: 14px 0px; padding: 0px 14px; } #ygrp-mkp hr{ border: 1px solid #d8d8d8; } #ygrp-mkp #hd{ color: #628c2a; font-size: 85%; font-weight: bold; line-height: 122%; margin: 10px 0px; } #ygrp-mkp #ads{ margin-bottom: 10px; } #ygrp-mkp .ad{ padding: 0 0; } #ygrp-mkp .ad a{ color: #0000ff; text-decoration: none; } --> Hi satyam,

            I'd try overriding doBeforeParseData and it seems to work fine (using Yahoo  URL as the data source). But why is that it doesn't work when using other data source feeds? One example is if I use this url feed:
            http://ss.ask.com/query?fn=myCallback&sstype=prefix&q=

            Here's my sample snippet:

            //Commented out.
            //var _yahooDemo = "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json&query=";

            var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix&q=";
            var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
            var  oAC = new YAHOO.widget.AutoComplete("myTextbox", "autocompleteContainer", oDS);
            oAC.queryDelay = .5;
                    // The webservice needs additional parameters
                    oAC.generateRequest = function(sQuery) {
                        return sQuery;
                    };


                //It should pop a message alert but doesn't. It works if I change my source to _yahooDemo.
               oDS.doBeforeParseData = function( oRequest , oFullResponse , oCallback ) {
                    alert("I should see this message");
                    return oFullResponse;
                };

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

            function myCallback(oResponse) {
            //Here's my callback fn. I can get the response here.
            }



            Any ideas on this?

            Regards,
            kennyth01



            --- In ydn-javascript@yahoogroups.com, wrote:
            >
            >
            > It is a little complicated, indeed. There is another alternative, check
            > method doBeforeParseDa ta in DataSource. It is function meant to be
            > overriden, the one that comes with DataSource does nothing else but return
            > one of the argument it receives untouched. You may, however, touch it
            > anyway you want as long as you return it in more or less the same shape.
            > They are documented, both in the user guide for DataSource and in the API,
            > check it out. doBeforeParseData is executed before any information is
            > parsed so the responseSchema has to reflect the data structure you return
            > from that function, not the one that function receives in one if its
            > arguments. That function is completely synchronous, you won't need to be
            > concerned about timing.
            >
            > Satyam
            >
            >
            > On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@...
            > wrote:
            > > Thanks for the pointers satyam. Does this also mean that I will create a
            > > seperate event to just trigger the Connection Manager's asyncRequest and
            > > make it as a LocalDataSource then instantiating the Autocomplete? Does
            > > this also mean that the attached event in the autocomplete will be
            > > useless?
            > >
            > > Regards,
            > > kennyth01
            > >
            > >
            > > --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
            > >>
            > >>
            > >> Then just use Connection Manager's asyncRequest to fetch the data,
            > > change
            > >> it to some suitable format and use a LocalDataSource to read the
            > > processed
            > >> result.
            > >>
            > >> Satyam
            > >>
            > >> On Mon, 04 May 2009 13:45:29 -0000, "kennyth01" kennyth01@
            > >> wrote:
            > >> > Thanks for the explanation Satyam.
            > >> > Yup you're right, the structure of the data is totally wrong. But is
            > >> there
            > >> > any workaround to be able to get the second array? How about gett ing
            > > it
            > >> and
            > >> > format it in a proper way?
            > >> >
            > >> >
            > >> >
            > >> >
            > >> >
            > >> >
            > >> > --- In ydn-javascript@yahoogroups.com, wrote:
            > >> >>
            > >> >>
            > >> >> As I said, that is not a proper format for what you mean. Sorry to
            > >> > sound
            > >> >> pedantic but the 'semantics' of your message is wrong. The structure
            > > of
            > >> >> your message does not convey the key:data relationship that you mean
            > > to
            > >> >> express. Both 'fruits' and the array containing the values are
            > > simple
            > >> >> items in an array, they are siblings, they don't have a key:values
            > >> >> relationship. That's why it is difficult to represent in the
            > >> >> responseSchema, because there is no way to express a relationship
            > > that
            > >> > does
            > >> >> not exist.
            > >> >>
            > >> >> Satyam
            > >> >>
            > >> >>
            > >> >> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01"
            > >> >> wrote:
            > >> >> > Thanks Satyam! I'll try this one out. But how about if I'm not
            > > using
            > >> >> > LocalDataSource? For example, I will use a script node:
            > >> >> >
            > >> >> > var oDS = new
            > >> >> >
            > >> >>
            > >> >
            > >>
            > >
            > YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback&q=");
            > >> >> >
            > >> >> > and the URL gives a response of :
            > >> >> > myCallback(['fruits',['g uava','mango','carrots']])
            > >> >> >
            > >> >> >
            > >> >> >
            > >> >> > How will I map this response to only get/display guava, mango and
            > >> > carrots
            > >> >> > on the list(autocomplete).
            > >> >> >
            > >> >> > Any idea on how is it on responseSchema? Thanks!
            > >> >> >
            > >> >> >
            > >> >> >
            > >> >> >
            > >> >> >
            > >> >> > --- In ydn-javascript@yahoogroups.com, wrote:
            > >> >> >>
            > >> >> >>
            > >> >> >>
            > >> >> >> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
            > >> >> >>
            > >> >> >> Hi masters,
            > >> >> >>
            > >> >> >> I have a problem getting results on an array data. Here's the
            > >> > snippet:
            > >> >> >>
            > >> >> >> ...
            > >> >> >>
            > >> >> >> var data = ['fruits',['guava','mango','carrots']];
            > >> >> >>
            > >> >> >> var oDS = new YAHOO.util.LocalDataSource(data);
            > >> >> >> You can change the line above to: var oDS = new
            > >> >> >> YAHOO.util.LocalDataSource(data[1]); and then forget about
            > >> > resultsList.
            > >> >> >> However,I think that what you want in that array above is more
            > > like:
            > >> >> >> {'fruits':['guave','mang','carrots']} Otherwise, the second item
            > > in
            > >> > the
            > >> >> >> array has no relation whatsoever to the first element
            > >> >> >> Satyam
            > >> >> >>
            > >> >> >> oDS.responseType = YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
            > >> >> >>
            > >> >> >> //I believe my mapping is wrong? Help me map on this please.
            > >> >> >> oDS.responseSchema = {
            > >> >> >> resultsList: ["Fruits"],
            > >> >> >> fields : ["Label"]
            > >> >> >> };
            > >> >> >> oAC = new YAHOO.widget.AutoComplete("sttop",
            > > "autocompleteContainer",
            > >> >> >> oDS);
            > >> >> >> oAC.queryDelay = .5;
            > >> >> >>
            > >> >> >> //How do I format it when I only want to display are list of
            > > fruits?
            > >> >> >> oAC.formatResult = function(oResultItem, sQuery) {
            > >> >> >>
            > >> >> >> return "_" + oResultItem[0] + "_";
            > >> >> >> };
            > >> >> >>
            > >> >> >> return {
            > >> >> >> oDS: oDS,
            > >> >> >> oAC: oAC
            > >> >> >> };
            > >> >> >>
            > >> >> >> Hoping someone will help me on this. Thanks!
            > >> >> >>
            > >> >> >>
            > >> >> >>
            > >> >> >> Links:
            > >> >> >> ------
            > >> >> >> [1]
            > >> >> >>
            > >> >> >
            > >> >>
            > >> >
            > >>
            > >
            > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
            > >> >> >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
            > >> ; > Delivery:
            > >> >> >> Digest
            > >> >> >> [3]
            > > mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
            > >> >> >> Delivery Format: Fully
            > >> >> >> Featured
            > >> >> >> [4]
            > >> >> >>
            > >> >> >
            > >> >>
            > >> >
            > >>
            > >
            > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
            > >> >> >> [5] http://docs.yahoo.com/info/terms/
            > >> >> >> [6]
            > >> >> >
            > > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
            > >> >> >>
            > >> >> >
            > >> >> >
            > >> >> >
            > >> >> >
            > >> >> > ------------------------------------
            > >> >> >
            > >> >> > Yahoo! Groups Links
            > >> >> >
            > >> >> >
            > >> >> >
            > >> >>
            > >> >
            > >> >
            > >> >
            > >> >
            > >> > ------------------------------------
            > >> >
            > >> > Yahoo! Groups Links
            > >> >
            > >> >
            > >> >
            > >>
            > >
            > >
            > >
            > >
            > > ------------------------------------
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            >
          • kennyth01
            Thanks satyam! YUI can t seem to worked if you specify a new callback method name.
            Message 5 of 20 , May 8, 2009
            • 0 Attachment
              Thanks satyam! YUI can't seem to worked if you specify a new callback method name.


              --- In ydn-javascript@yahoogroups.com, <satyam@...> wrote:
              >
              >
              >
              > It looks Ok the way it is. If you use Firefox with Firebug, in the Net or
              > Console tabs you will see the actual request and response to your query.
              > That might give you a clue as to what is actually going on.
              >
              > On Tue, 05 May 2009 12:08:05 -0000, "kennyth01" wrote:
              >
              > Hi satyam,
              >
              > I'd try overriding doBeforeParseData and it seems to work fine (using
              > Yahoo URL as the data source). But why is that it doesn't work when using
              > other data source feeds? One example is if I use this url feed:
              > http://ss.ask.com/query?fn=myCallback&sstype=prefix">//Commented out.
              > //var _yahooDemo =
              > "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json
              >
              > var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix
              > var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
              > var oAC = new YAHOO.widget.AutoComplete("myTextbox",
              > "autocompleteContainer", oDS);
              > oAC.queryDelay = .5;
              > // The webservice needs additional parameters
              > oAC.generateRequest = function(sQuery) {
              > return
              > sQuery;
              > };
              >
              > //IT SHOULD POP A MESSAGE ALERT BUT DOESN'T. IT WORKS IF I CHANGE MY
              > SOURCE TO _YAHOODEMO.
              > oDS.doBeforeParseData = function( oRequest , oFullResponse , oCallback )
              > {
              > alert("I should see this message");
              > return oFullResponse;
              > };
              >
              > return {
              > oDS: oDS,
              > oAC: oAC
              > };
              > ....
              >
              > function myCallback(oResponse) {
              > //Here's my callback fn. I can get the response here.
              > }
              >
              > Any ideas on this?
              >
              > Regards,
              > kennyth01
              >
              > --- In ydn-javascript@yahoogroups.com, wrote:
              > >
              > >
              > > It is a little complicated, indeed. There is another alternative, check
              > > method doBeforeParseDa ta in DataSource. It is function meant to be
              > > overriden, the one that comes with DataSource does nothing else but
              > return
              > > one of the argument it receives untouched. You may, however, touch it
              > > anyway you want as long as you return it in more or less the same shape.
              >
              > > They are documented, both in the user guide for DataSource and in the
              > API,
              > > check it out. doBeforeParseData is executed before any information is
              > > parsed so
              > the responseSchema has to reflect the data structure you
              > return
              > > from that function, not the one that function receives in one if its
              > > arguments. That function is completely synchronous, you won't need to be
              > > concerned about timing.
              > >
              > > Satyam
              > >
              > >
              > > On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@
              > > wrote:
              > > > Thanks for the pointers satyam. Does this also mean that I will create
              > a
              > > > seperate event to just trigger the Connection Manager's asyncRequest
              > and
              > > > make it as a LocalDataSource then instantiating the Autocomplete? Does
              > > > this also mean that the attached event in the autocomplete will be
              > > > useless?
              > > >
              > > > Regards,
              > > > kennyth01
              > > >
              > > >
              > > > --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
              > > >>
              > > >>
              > > >> Then just use Connection Manager's asyncRequest to fetch the data,
              > > > change
              > > >> it to some suitable format and use a LocalDataSource to read the
              > > > processed
              > > >> result.
              > > >>
              > > >> Satyam
              > > >>
              > > >> On Mon, 04 May 2009 13:45:29 -0000,
              > "kennyth01" kennyth01@
              > > >> wrote:
              > > >> > Thanks for the explanation Satyam.
              > > >> > Yup you're right, the structure of the data is totally wrong. But
              > is
              > > >> there
              > > >> > any workaround to be able to get the second array? How about gett
              > ing
              > > > it
              > > >> and
              > > >> > format it in a proper way?
              > > >> >
              > > >> >
              > > >> >
              > > >> >
              > > >> >
              > > >> >
              > > >> > --- In ydn-javascript@yahoogroups.com, wrote:
              > > >> >>
              > > >> >>
              > > >> >> As I said, that is not a proper format for what you mean. Sorry to
              > > >> > sound
              > > >> >> pedantic but the 'semantics' of your message is wrong. The
              > structure
              > > > of
              > > >> >> your message does not convey the key:data relationship that you
              > mean
              > > > to
              > > >> >> express. Both 'fruits' and the array containing the values are
              > > > simple
              > > >> >> items in an array, they are siblings, they don't have a key:values
              > > >> >> relationship. That's why it is difficult to represent in the
              > > >> >> responseSchema, because there is no way to express a relationship
              > > > that
              > > >> > does
              > > >> >> not
              > exist.
              > > >> >>
              > > >> >> Satyam
              > > >> >>
              > > >> >>
              > > >> >> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01"
              > > >> >> wrote:
              > > >> >> > Thanks Satyam! I'll try this one out. But how about if I'm not
              > > > using
              > > >> >> > LocalDataSource? For example, I will use a script node:
              > > >> >> >
              > > >> >> > var oDS = new
              > > >> >> >
              > > >> >>
              > > >> >
              > > >>
              > > >
              > >
              > YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback
              > > >> >> >
              > > >> >> > and the URL gives a response of :
              > > >> >> > myCallback(['fruits',['g uava','mango','carrots']])
              > > >> >> >
              > > >> >> >
              > > >> >> >
              > > >> >> > How will I map this response to only get/display guava, mango
              > and
              > > >> > carrots
              > > >> >> > on the list(autocomplete).
              > > >> >> >
              > > >> >> > Any idea on how is it on responseSchema? Thanks!
              > > >> >> >
              > > >> >> >
              > > >> >> >
              > > >> >> >
              > > >> >> >
              > > >> >> > --- In ydn-javascript@yahoogroups.com, wrote:
              > > >> >> >>
              > > >> >> >>
              > > >> >> >>
              > > >> >> >> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
              > > >> >> >>
              > > >> >> >> Hi
              > masters,
              > > >> >> >>
              > > >> >> >> I have a problem getting results on an array data. Here's the
              > > >> > snippet:
              > > >> >> >>
              > > >> >> >> ...
              > > >> >> >>
              > > >> >> >> var data = ['fruits',['guava','mango','carrots']];
              > > >> >> >>
              > > >> >> >> var oDS = new YAHOO.util.LocalDataSource(data);
              > > >> >> >> You can change the line above to: var oDS = new
              > > >> >> >> YAHOO.util.LocalDataSource(data[1]); and then forget about
              > > >> > resultsList.
              > > >> >> >> However,I think that what you want in that array above is more
              > > > like:
              > > >> >> >> {'fruits':['guave','mang','carrots']} Otherwise, the second
              > item
              > > > in
              > > >> > the
              > > >> >> >> array has no relation whatsoever to the first element
              > > >> >> >> Satyam
              > > >> >> >>
              > > >> >> >> oDS.responseType =
              > YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
              > > >> >> >>
              > > >> >> >> //I believe my mapping is wrong? Help me map on this please.
              > > >> >> >> oDS.responseSchema = {
              > > >> >> >> resultsList: ["Fruits"],
              > > >> >> >> fields : ["Label"]
              > > >> >> >> };
              > > >> >> >> oAC = new
              > YAHOO.widget.AutoComplete("sttop",
              > > > "autocompleteContainer",
              > > >> >> >> oDS);
              > > >> >> >> oAC.queryDelay = .5;
              > > >> >> >>
              > > >> >> >> //How do I format it when I only want to display are list of
              > > > fruits?
              > > >> >> >> oAC.formatResult = function(oResultItem, sQuery) {
              > > >> >> >>
              > > >> >> >> return "_" + oResultItem[0] + "_";
              > > >> >> >> };
              > > >> >> >>
              > > >> >> >> return {
              > > >> >> >> oDS: oDS,
              > > >> >> >> oAC: oAC
              > > >> >> >> };
              > > >> >> >>
              > > >> >> >> Hoping someone will help me on this. Thanks!
              > > >> >> >>
              > > >> >> >>
              > > >> >> >>
              > > >> >> >> Links:
              > > >> >> >> ------
              > > >> >> >> [1]
              > > >> >> >>
              > > >> >> >
              > > >> >>
              > > >> >
              > > >>
              > > >
              > >
              > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
              > > >> >> >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
              > > >> ; > Delivery:
              > > >> >> >> Digest
              > > >> >> >> [3]
              > > >
              > mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
              > > >> >> >> Delivery Format: Fully
              > > >> >> >> Featured
              > > >> >> >> [4]
              > > >> >> >>
              > > >> >> >
              > > >> >>
              > > >> >
              > > >>
              > > >
              > >
              > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
              > > >> >> >> [5] http://docs.yahoo.com/info/terms/
              > > >> >> >> [6]
              > > >> >> >
              > > > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
              > > >> >> >>
              > > >> >> >
              > > >> >> >
              > > >> >> >
              > > >> >> >
              > > >> >> > ------------------------------------
              > > >> >> >
              > > >> >> > Yahoo! Groups Links
              > > >> >> >
              > > >> >> >
              > > >> >> >
              > > >> >>
              > > >> >
              > > >> >
              > > >> >
              > > >> >
              > > >> > ------------------------------------
              > > >> >
              > > >> > Yahoo! Groups Links
              > > >> >
              > > >> >
              > > >> >
              > > >>
              > > >
              > > >
              > > >
              > > >
              > > > ------------------------------------
              > > >
              > > > Yahoo! Groups Links
              > > >
              > > >
              > > >
              > >
              >
              >
              >
              > Links:
              > ------
              > [1]
              > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnb21sNGRyBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNTI1MzUz
              > [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email Delivery:
              > Digest
              > [3] mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
              > Delivery Format: Fully Featured
              > [4]
              > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJlOThha2poBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTUyNTM1Mw--
              > [5] http://docs.yahoo.com/info/terms/
              > [6] mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
              >
            • Satyam
              If you can verify this is so, please do file a bug report. The author of the component will sure want to know. If you can place a working copy of the buggy
              Message 6 of 20 , May 8, 2009
              • 0 Attachment
                If you can verify this is so, please do file a bug report. The author
                of the component will sure want to know. If you can place a working
                copy of the buggy code to see it fail, that would be great.

                Satyam


                kennyth01 escribió:
                > Thanks satyam! YUI can't seem to worked if you specify a new callback method name.
                >
                >
                > --- In ydn-javascript@yahoogroups.com, <satyam@...> wrote:
                >
                >>
                >> It looks Ok the way it is. If you use Firefox with Firebug, in the Net or
                >> Console tabs you will see the actual request and response to your query.
                >> That might give you a clue as to what is actually going on.
                >>
                >> On Tue, 05 May 2009 12:08:05 -0000, "kennyth01" wrote:
                >>
                >> Hi satyam,
                >>
                >> I'd try overriding doBeforeParseData and it seems to work fine (using
                >> Yahoo URL as the data source). But why is that it doesn't work when using
                >> other data source feeds? One example is if I use this url feed:
                >> http://ss.ask.com/query?fn=myCallback&sstype=prefix">//Commented out.
                >> //var _yahooDemo =
                >> "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json
                >>
                >> var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix
                >> var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
                >> var oAC = new YAHOO.widget.AutoComplete("myTextbox",
                >> "autocompleteContainer", oDS);
                >> oAC.queryDelay = .5;
                >> // The webservice needs additional parameters
                >> oAC.generateRequest = function(sQuery) {
                >> return
                >> sQuery;
                >> };
                >>
                >> //IT SHOULD POP A MESSAGE ALERT BUT DOESN'T. IT WORKS IF I CHANGE MY
                >> SOURCE TO _YAHOODEMO.
                >> oDS.doBeforeParseData = function( oRequest , oFullResponse , oCallback )
                >> {
                >> alert("I should see this message");
                >> return oFullResponse;
                >> };
                >>
                >> return {
                >> oDS: oDS,
                >> oAC: oAC
                >> };
                >> ....
                >>
                >> function myCallback(oResponse) {
                >> //Here's my callback fn. I can get the response here.
                >> }
                >>
                >> Any ideas on this?
                >>
                >> Regards,
                >> kennyth01
                >>
                >> --- In ydn-javascript@yahoogroups.com, wrote:
                >>
                >>> It is a little complicated, indeed. There is another alternative, check
                >>> method doBeforeParseDa ta in DataSource. It is function meant to be
                >>> overriden, the one that comes with DataSource does nothing else but
                >>>
                >> return
                >>
                >>> one of the argument it receives untouched. You may, however, touch it
                >>> anyway you want as long as you return it in more or less the same shape.
                >>>
                >>> They are documented, both in the user guide for DataSource and in the
                >>>
                >> API,
                >>
                >>> check it out. doBeforeParseData is executed before any information is
                >>> parsed so
                >>>
                >> the responseSchema has to reflect the data structure you
                >> return
                >>
                >>> from that function, not the one that function receives in one if its
                >>> arguments. That function is completely synchronous, you won't need to be
                >>> concerned about timing.
                >>>
                >>> Satyam
                >>>
                >>>
                >>> On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@
                >>> wrote:
                >>>
                >>>> Thanks for the pointers satyam. Does this also mean that I will create
                >>>>
                >> a
                >>
                >>>> seperate event to just trigger the Connection Manager's asyncRequest
                >>>>
                >> and
                >>
                >>>> make it as a LocalDataSource then instantiating the Autocomplete? Does
                >>>> this also mean that the attached event in the autocomplete will be
                >>>> useless?
                >>>>
                >>>> Regards,
                >>>> kennyth01
                >>>>
                >>>>
                >>>> --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                >>>>
                >>>>> Then just use Connection Manager's asyncRequest to fetch the data,
                >>>>>
                >>>> change
                >>>>
                >>>>> it to some suitable format and use a LocalDataSource to read the
                >>>>>
                >>>> processed
                >>>>
                >>>>> result.
                >>>>>
                >>>>> Satyam
                >>>>>
                >>>>> On Mon, 04 May 2009 13:45:29 -0000,
                >>>>>
                >> "kennyth01" kennyth01@
                >>
                >>>>> wrote:
                >>>>>
                >>>>>> Thanks for the explanation Satyam.
                >>>>>> Yup you're right, the structure of the data is totally wrong. But
                >>>>>>
                >> is
                >>
                >>>>> there
                >>>>>
                >>>>>> any workaround to be able to get the second array? How about gett
                >>>>>>
                >> ing
                >>
                >>>> it
                >>>>
                >>>>> and
                >>>>>
                >>>>>> format it in a proper way?
                >>>>>>
                >>>>>>
                >>>>>>
                >>>>>>
                >>>>>>
                >>>>>>
                >>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                >>>>>>
                >>>>>>> As I said, that is not a proper format for what you mean. Sorry to
                >>>>>>>
                >>>>>> sound
                >>>>>>
                >>>>>>> pedantic but the 'semantics' of your message is wrong. The
                >>>>>>>
                >> structure
                >>
                >>>> of
                >>>>
                >>>>>>> your message does not convey the key:data relationship that you
                >>>>>>>
                >> mean
                >>
                >>>> to
                >>>>
                >>>>>>> express. Both 'fruits' and the array containing the values are
                >>>>>>>
                >>>> simple
                >>>>
                >>>>>>> items in an array, they are siblings, they don't have a key:values
                >>>>>>> relationship. That's why it is difficult to represent in the
                >>>>>>> responseSchema, because there is no way to express a relationship
                >>>>>>>
                >>>> that
                >>>>
                >>>>>> does
                >>>>>>
                >>>>>>> not
                >>>>>>>
                >> exist.
                >>
                >>>>>>> Satyam
                >>>>>>>
                >>>>>>>
                >>>>>>> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01"
                >>>>>>> wrote:
                >>>>>>>
                >>>>>>>> Thanks Satyam! I'll try this one out. But how about if I'm not
                >>>>>>>>
                >>>> using
                >>>>
                >>>>>>>> LocalDataSource? For example, I will use a script node:
                >>>>>>>>
                >>>>>>>> var oDS = new
                >>>>>>>>
                >>>>>>>>
                >> YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback
                >>
                >>>>>>>> and the URL gives a response of :
                >>>>>>>> myCallback(['fruits',['g uava','mango','carrots']])
                >>>>>>>>
                >>>>>>>>
                >>>>>>>>
                >>>>>>>> How will I map this response to only get/display guava, mango
                >>>>>>>>
                >> and
                >>
                >>>>>> carrots
                >>>>>>
                >>>>>>>> on the list(autocomplete).
                >>>>>>>>
                >>>>>>>> Any idea on how is it on responseSchema? Thanks!
                >>>>>>>>
                >>>>>>>>
                >>>>>>>>
                >>>>>>>>
                >>>>>>>>
                >>>>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                >>>>>>>>
                >>>>>>>>>
                >>>>>>>>> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
                >>>>>>>>>
                >>>>>>>>> Hi
                >>>>>>>>>
                >> masters,
                >>
                >>>>>>>>> I have a problem getting results on an array data. Here's the
                >>>>>>>>>
                >>>>>> snippet:
                >>>>>>
                >>>>>>>>> ...
                >>>>>>>>>
                >>>>>>>>> var data = ['fruits',['guava','mango','carrots']];
                >>>>>>>>>
                >>>>>>>>> var oDS = new YAHOO.util.LocalDataSource(data);
                >>>>>>>>> You can change the line above to: var oDS = new
                >>>>>>>>> YAHOO.util.LocalDataSource(data[1]); and then forget about
                >>>>>>>>>
                >>>>>> resultsList.
                >>>>>>
                >>>>>>>>> However,I think that what you want in that array above is more
                >>>>>>>>>
                >>>> like:
                >>>>
                >>>>>>>>> {'fruits':['guave','mang','carrots']} Otherwise, the second
                >>>>>>>>>
                >> item
                >>
                >>>> in
                >>>>
                >>>>>> the
                >>>>>>
                >>>>>>>>> array has no relation whatsoever to the first element
                >>>>>>>>> Satyam
                >>>>>>>>>
                >>>>>>>>> oDS.responseType =
                >>>>>>>>>
                >> YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                >>
                >>>>>>>>> //I believe my mapping is wrong? Help me map on this please.
                >>>>>>>>> oDS.responseSchema = {
                >>>>>>>>> resultsList: ["Fruits"],
                >>>>>>>>> fields : ["Label"]
                >>>>>>>>> };
                >>>>>>>>> oAC = new
                >>>>>>>>>
                >> YAHOO.widget.AutoComplete("sttop",
                >>
                >>>> "autocompleteContainer",
                >>>>
                >>>>>>>>> oDS);
                >>>>>>>>> oAC.queryDelay = .5;
                >>>>>>>>>
                >>>>>>>>> //How do I format it when I only want to display are list of
                >>>>>>>>>
                >>>> fruits?
                >>>>
                >>>>>>>>> oAC.formatResult = function(oResultItem, sQuery) {
                >>>>>>>>>
                >>>>>>>>> return "_" + oResultItem[0] + "_";
                >>>>>>>>> };
                >>>>>>>>>
                >>>>>>>>> return {
                >>>>>>>>> oDS: oDS,
                >>>>>>>>> oAC: oAC
                >>>>>>>>> };
                >>>>>>>>>
                >>>>>>>>> Hoping someone will help me on this. Thanks!
                >>>>>>>>>
                >>>>>>>>>
                >>>>>>>>>
                >>>>>>>>> Links:
                >>>>>>>>> ------
                >>>>>>>>> [1]
                >>>>>>>>>
                >>>>>>>>>
                >> http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
                >>
                >>>>>>>>> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                >>>>>>>>>
                >>>>> ; > Delivery:
                >>>>>
                >>>>>>>>> Digest
                >>>>>>>>> [3]
                >>>>>>>>>
                >> mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                >>
                >>>>>>>>> Delivery Format: Fully
                >>>>>>>>> Featured
                >>>>>>>>> [4]
                >>>>>>>>>
                >>>>>>>>>
                >> http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
                >>
                >>>>>>>>> [5] http://docs.yahoo.com/info/terms/
                >>>>>>>>> [6]
                >>>>>>>>>
                >>>> mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                >>>>
                >>>>>>>>
                >>>>>>>>
                >>>>>>>> ------------------------------------
                >>>>>>>>
                >>>>>>>> Yahoo! Groups Links
                >>>>>>>>
                >>>>>>>>
                >>>>>>>>
                >>>>>>>>
                >>>>>>
                >>>>>>
                >>>>>> ------------------------------------
                >>>>>>
                >>>>>> Yahoo! Groups Links
                >>>>>>
                >>>>>>
                >>>>>>
                >>>>>>
                >>>>
                >>>>
                >>>> ------------------------------------
                >>>>
                >>>> Yahoo! Groups Links
                >>>>
                >>>>
                >>>>
                >>>>
                >>
                >>
                >> Links:
                >> ------
                >> [1]
                >> http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnb21sNGRyBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNTI1MzUz
                >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email Delivery:
                >> Digest
                >> [3] mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                >> Delivery Format: Fully Featured
                >> [4]
                >> http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJlOThha2poBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTUyNTM1Mw--
                >> [5] http://docs.yahoo.com/info/terms/
                >> [6] mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                >>
                >>
                >
                >
                >
                >
                > ------------------------------------
                >
                > Yahoo! Groups Links
                >
                >
                >
                > ------------------------------------------------------------------------
                >
                >
                > No virus found in this incoming message.
                > Checked by AVG - www.avg.com
                > Version: 8.5.287 / Virus Database: 270.12.21/2104 - Release Date: 05/08/09 06:34:00
                >
                >
              • kennyth01
                Hi satyam, Here s the sample code, just copy and paste the code below and save it in a html format :
                Message 7 of 20 , May 10, 2009
                • 0 Attachment
                  Hi satyam,

                  Here's the sample code, just copy and paste the code below and save it in a html format :

                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                  <!--CSS file (default YUI Sam Skin) -->
                  <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/autocomplete/assets/skins/sam/autocomplete.css">

                  <!-- Dependencies -->
                  <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>


                  <!-- OPTIONAL: Get (required only if using ScriptNodeDataSource) -->
                  <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/get/get-min.js"></script>

                  <!-- OPTIONAL: Animation (required only if enabling animation) -->
                  <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js"></script>

                  <!-- OPTIONAL: JSON (enables JSON validation) -->
                  <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/json/json-min.js"></script>

                  <!-- Source file -->
                  <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/datasource/datasource-min.js"></script>
                  <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/connection/connection-min.js"></script>
                  <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/autocomplete/autocomplete-min.js"></script>


                  <title>ScriptCallback param Autocomplete/title>
                  </head>

                  <body onload="initialize()">
                  // An outer container contains an input element and
                  // a empty results container, both of which are passed
                  // to the constructor
                  <div id="myAutoComplete">
                      <input id="myInput" type="text">
                      <div id="myContainer"></div>
                  </div>
                  </body>


                  <script language="javascript" type="text/javascript">
                  function initialize () {
                  var ds = new YAHOO.util.ScriptNodeDataSource("http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=");
                  var myAutoComp = new YAHOO.widget.AutoComplete("myInput","myContainer", ds);


                          myAutoComp.queryDelay             = .5;
                          myAutoComp.maxResultsDisplayed = 10;
                          myAutoComp.typeAhead            = true;
                         
                         
                                  ds.scriptCallbackParam = "fn";
                                  ds.responseSchema = {
                                                      fields: ["Text"]
                                                      };
                                  ds.responseType = YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                                  myAutoComp.generateRequest = function(sQuery) {
                                  return sQuery;
                                  };
                                  //get only the array of suggestions...
                                  ds.doBeforeParseData = function( oRequest , oFullResponse , oCallback ) {
                                      return oFullResponse[1];
                                  };

                  return {
                              oDS: ds,
                              oAC: myAutoComp
                          };
                  }
                  </script>
                  </html>



                  Looking at the Net tab of Firefox, the request url generated is :
                  http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=d&fn=YAHOO.util.ScriptNodeDataSource.callbacks[0]
                  and the response given is:
                  ["d",["dictionary","disney channel","dell","driving directions","delta airlines","directions","dom deluise","dancing with the stars","dish network","dmv"],[],[]]


                  I think the problem here is that YUI expects the response to be like this:
                  YAHOO.util.ScriptNodeDataSource.callbacks[0](["d",["dictionary","disney channel","dell","driving directions","delta airlines","directions","dom deluise","dancing with the stars","dish network","dmv"],[],[]])
                  Take note that its wrapped in a callback that is generated by YUI


                  My questions are:

                  1. Is there any other workaround for I to hacked the response and then passed that to the autocomplete? If so, feel free to modify the code.

                  2. In relation to my 1st question, can I create my own callback function name and it's possible if YUI  can understand that? (e.g the response would be like):
                  myOwnCallback(["d",["dictionary","disney channel","dell","driving directions","delta airlines","directions","dom deluise","dancing with the stars","dish network","dmv"],[],[]])
                   I think I could create my own callback by overriding the generateCallback of data source but how will I make it work if YUI expects the response (I think) with YAHOO.util.ScriptNodeDataSource.callbacks[0] as the callback name.


                  Please see the code above and if possible help me on my problem. Thanks a lot in advance.

                  Regards,
                  kennyth01




                  --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
                  >
                  > If you can verify this is so, please do file a bug report. The author
                  > of the component will sure want to know. If you can place a working
                  > copy of the buggy code to see it fail, that would be great.
                  >
                  > Satyam
                  >
                  >
                  > kennyth01 escribió:
                  > > Thanks satyam! YUI can't seem to worked if you specify a new callback method name.
                  > >
                  > >
                  > > --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                  > >
                  > >>
                  > >> It looks Ok the way it is. If you use Firefox with Firebug, in the Net or
                  > >> Console tabs you will see the actual request and response to your query.
                  > >> That might give you a clue as to what is actually going on.
                  > >>
                  > >> On Tue, 05 May 2009 12:08:05 -0000, "kennyth01" wrote:
                  > >>
                  > >> Hi satyam,
                  > >>
                  > >> I'd try overriding doBeforeParseData and it seems to work fine (using
                  > >> Yahoo URL as the data source). But why is that it doesn't work when using
                  > >> other data source feeds? One example is if I use this url feed:
                  > >> http://ss.ask.com/query?fn=myCallback&sstype=prefix">//Commented out.
                  > >> //var _yahooDemo =
                  > >> "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json
                  > >>
                  > >> var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix
                  > >> var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
                  > >> var oAC = new YAHOO.widget.AutoComplete("myTextbox",
                  > >> "autocompleteContainer", oDS);
                  > >> oAC.queryDelay = .5;
                  > >> // The webservice needs additional parameters
                  > >> oAC.generateRequest = function(sQuery) {
                  > >> return
                  > >> sQuery;
                  > >> };
                  > >>
                  > >> //IT SHOULD POP A MESSAGE ALERT BUT DOESN'T. IT WORKS IF I CHANGE MY
                  > >> SOURCE TO _YAHOODEMO.
                  > >> oDS.doBeforeParseData = function( oRequest , oFullResponse , oCallback )
                  > >> {
                  > >> alert("I should see this message");
                  > >> return oFullResponse;
                  > >> };
                  > >>
                  > >> return {
                  > >> oDS: oDS,
                  > >> oAC: oAC
                  > >> };
                  > >> ....
                  > >>
                  > >> function myCallback(oResponse) {
                  > >> //Here's my callback fn. I can get the response here.
                  > >> }
                  > >>
                  > >> Any ideas on this?
                  > >>
                  > >> Regards,
                  > >> kennyth01
                  > >>
                  > >> --- In ydn-javascript@yahoogroups.com, wrote:
                  > >>
                  > >>> It is a little complicated, indeed. There is another alternative, check
                  > >>> method doBeforeParseDa ta in DataSource. It is function meant to be
                  > >>> overriden, the one that comes with DataSource does nothing else but
                  > >>>
                  > >> return
                  > >>
                  > >>> one of the argument it receives untouched. You may, however, touch it
                  > >>> anyway you want as long as you return it in more or less the same shape.
                  > >>>
                  > >>> They are documented, both in the user guide for DataSource and in the
                  > >>>
                  > >> API,
                  > >>
                  > >>> check it out. doBeforeParseData is executed before any information is
                  > >>> parsed so
                  > >>>
                  > >> the responseSchema has to reflect the data structure you
                  > >> return
                  > >>
                  > >>> from that function, not the one that function receives in one if its
                  > >>> arguments. That function is completely synchronous, you won't need to be
                  > >>> concerned about timing.
                  > >>>
                  > >>> Satyam
                  > >>>
                  > >>>
                  > >>> On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@
                  > >>> wrote:
                  > >>>
                  > >>>> Thanks for the pointers satyam. Does this also mean that I will create
                  > >>>>
                  > >> a
                  > >>
                  > >>>> seperate event to just trigger the Connection Manager's asyncRequest
                  > >>>>
                  > >> and
                  > >>
                  > >>>> make it as a LocalDataSource then instantiating the Autocomplete? Does
                  > >>>> this also mean that the attached event in the autocomplete will be
                  > >>>> useless?
                  > >>>>
                  > >>>> Regards,
                  > >>>> kennyth01
                  > >>>>
                  > >>>>
                  > >>>> --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                  > >>>>
                  > >>>>> Then just use Connection Manager's asyncRequest to fetch the data,
                  > >>>>>
                  > >>>> change
                  > >>>>
                  > >>>>> it to some suitable format and use a LocalDataSource to read the
                  > >>>>>
                  > >>>> processed
                  > >>>>
                  > >>>>> result.
                  > >>>>>
                  > >>>>> Satyam
                  > >>>>>
                  > >>>>> On Mon, 04 May 2009 13:45:29 -0000,
                  > >>>>>
                  > >> "kennyth01" kennyth01@
                  > >>
                  > >>>>> wrote:
                  > >>>>>
                  > >>>>>> Thanks for the explanation Satyam.
                  > >>>>>> Yup you're right, the structure of the data is totally wrong. But
                  > >>>>>>
                  > >> is
                  > >>
                  > >>>>> there
                  > >>>>>
                  > >>>>>> any workaround to be able to get the second array? How about gett
                  > >>>>>>
                  > >> ing
                  > >>
                  > >>>> it
                  > >>>>
                  > >>>>> and
                  > >>>>>
                  > >>>>>> format it in a proper way?
                  > >>>>>>
                  > >>>>>>
                  > >>>>>>
                  > >>>>>>
                  > >>>>>>
                  > >>>>>>
                  > >>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                  > >>>>>>
                  > >>>>>>> As I said, that is not a proper format for what you mean. Sorry to
                  > >>>>>>>
                  > >>>>>> sound
                  > >>>>>>
                  > >>>>>>> pedantic but the 'semantics' of your message is wrong. The
                  > >>>>>>>
                  > >> structure
                  > >>
                  > >>>> of
                  > >>>>
                  > >>>>>>> your message does not convey the key:data relationship that you
                  > >>>>>>>
                  > >> mean
                  > >>
                  > >>>> to
                  > >>>>
                  > >>>>>>> express. Both 'fruits' and the array containing the values are
                  > >>>>>>>
                  > >>>> simple
                  > >>>>
                  > >>>>>>> items in an array, they are siblings, they don't have a key:values
                  > >>>>>>> relationship. That's why it is difficult to represent in the
                  > >>>>>>> responseSchema, because there is no way to express a relationship
                  > >>>>>>>
                  > >>>> that
                  > >>>>
                  > >>>>>> does
                  > >>>>>>
                  > >>>>>>> not
                  > >>>>>>>
                  > >> exist.
                  > >>
                  > >>>>>>> Satyam
                  > >>>>>>>
                  > >>>>>>>
                  > >>>>>>> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01"
                  > >>>>>>> wrote:
                  > >>>>>>>
                  > >>>>>>>> Thanks Satyam! I'll try this one out. But how about if I'm not
                  > >>>>>>>>
                  > >>>> using
                  > >>>>
                  > >>>>>>>> LocalDataSource? For example, I will use a script node:
                  > >>>>>>>>
                  > >>>>>>>> var oDS = new
                  > >>>>>>>>
                  > >>>>>>>>
                  > >> YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback
                  > >>
                  > >>>>>>>> and the URL gives a response of :
                  > >>>>>>>> myCallback(['fruits',['g uava','mango','carrots']])
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>> How will I map this response to only get/display guava, mango
                  > >>>>>>>>
                  > >> and
                  > >>
                  > >>>>>> carrots
                  > >>>>>>
                  > >>>>>>>> on the list(autocomplete).
                  > >>>>>>>>
                  > >>>>>>>> Any idea on how is it on responseSchema? Thanks!
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                  > >>>>>>>>
                  > >>>>>>>>>
                  > >>>>>>>>> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
                  > >>>>>>>>>
                  > >>>>>>>>> Hi
                  > >>>>>>>>>
                  > >> masters,
                  > >>
                  > >>>>>>>>> I have a problem getting results on an array data. Here's the
                  > >>>>>>>>>
                  > >>>>>> snippet:
                  > >>>>>>
                  > >>>>>>>>> ...
                  > >>>>>>>>>
                  > >>>>>>>>> var data = ['fruits',['guava','mango','carrots']];
                  > >>>>>>>>>
                  > >>>>>>>>> var oDS = new YAHOO.util.LocalDataSource(data);
                  > >>>>>>>>> You can change the line above to: var oDS = new
                  > >>>>>>>>> YAHOO.util.LocalDataSource(data[1]); and then forget about
                  > >>>>>>>>>
                  > >>>>>> resultsList.
                  > >>>>>>
                  > >>>>>>>>> However,I think that what you want in that array above is more
                  > >>>>>>>>>
                  > >>>> like:
                  > >>>>
                  > >>>>>>>>> {'fruits':['guave','mang','carrots']} Otherwise, the second
                  > >>>>>>>>>
                  > >> item
                  > >>
                  > >>>> in
                  > >>>>
                  > >>>>>> the
                  > >>>>>>
                  > >>>>>>>>> array has no relation whatsoever to the first element
                  > >>>>>>>>> Satyam
                  > >>>>>>>>>
                  > >>>>>>>>> oDS.responseType =
                  > >>>>>>>>>
                  > >> YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                  > >>
                  > >>>>>>>>> //I believe my mapping is wrong? Help me map on this please.
                  > >>>>>>>>> oDS.responseSchema = {
                  > >>>>>>>>> resultsList: ["Fruits"],
                  > >>>>>>>>> fields : ["Label"]
                  > >>>>>>>>> };
                  > >>>>>>>>> oAC = new
                  > >>>>>>>>>
                  > >> YAHOO.widget.AutoComplete("sttop",
                  > >>
                  > >>>> "autocompleteContainer",
                  > >>>>
                  > >>>>>>>>> oDS);
                  > >>>>>>>>> oAC.queryDelay = .5;
                  > >>>>>>>>>
                  > >>>>>>>>> //How do I format it when I only want to display are list of
                  > >>>>>>>>>
                  > >>>> fruits?
                  > >>>>
                  > >>>>>>>>> oAC.formatResult = function(oResultItem, sQuery) {
                  > >>>>>>>>>
                  > >>>>>>>>> return "_" + oResultItem[0] + "_";
                  > >>>>>>>>> };
                  > >>>>>>>>>
                  > >>>>>>>>> return {
                  > >>>>>>>>> oDS: oDS,
                  > >>>>>>>>> oAC: oAC
                  > >>>>>>>>> };
                  > >>>>>>>>>
                  > >>>>>>>>> Hoping someone will help me on this. Thanks!
                  > >>>>>>>>>
                  > >>>>>>>>>
                  > >>>>>>>>>
                  > >>>>>>>>> Links:
                  > >>>>>>>>> ------
                  > >>>>>>>>> [1]
                  > >>>>>>>>>
                  > >>>>>>>>>
                  > >> http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
                  > >>
                  > >>>>>>>>> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                  > >>>>>>>>>
                  > >>>>> ; > Delivery:
                  > >>>>>
                  > >>>>>>>>> Digest
                  > >>>>>>>>> [3]
                  > >>>>>>>>>
                  > >> mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                  > >>
                  > >>>>>>>>> Delivery Format: Fully
                  > >>>>>>>>> Featured
                  > >>>>>>>>> [4]
                  > >>>>>>>>>
                  > >>>>>>>>>
                  > >> http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
                  > >>
                  > >>>>>>>>> [5] http://docs.yahoo.com/info/terms/
                  > >>>>>>>>> [6]
                  > >>>>>>>>>
                  > >>>> mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                  > >>>>
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>> ------------------------------------
                  > >>>>>>>>
                  > >>>>>>>> Yahoo! Groups Links
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>>>
                  > >>>>>>
                  > >>>>>>
                  > >>>>>> ------------------------------------
                  > >>>>>>
                  > >>>>>> Yahoo! Groups Links
                  > >>>>>>
                  > >>>>>>
                  > >>>>>>
                  > >>>>>>
                  > >>>>
                  > >>>>
                  > >>>> ------------------------------------
                  > >>>>
                  > >>>> Yahoo! Groups Links
                  > >>>>
                  > >>>>
                  > >>>>
                  > >>>>
                  > >>
                  > >>
                  > >> Links:
                  > >> ------
                  > >> [1]
                  > >> http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnb21sNGRyBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNTI1MzUz
                  > >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email Delivery:
                  > >> Digest
                  > >> [3] mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                  > >> Delivery Format: Fully Featured
                  > >> [4]
                  > >> http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJlOThha2poBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTUyNTM1Mw--
                  > >> [5] http://docs.yahoo.com/info/terms/
                  > >> [6] mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                  > >>
                  > >>
                  > >
                  > >
                  > >
                  > >
                  > > ------------------------------------
                  > >
                  > > Yahoo! Groups Links
                  > >
                  > >
                  > >
                  > > ------------------------------------------------------------------------
                  > >
                  > >
                  > > No virus found in this incoming message.
                  > > Checked by AVG - www.avg.com
                  > > Version: 8.5.287 / Virus Database: 270.12.21/2104 - Release Date: 05/08/09 06:34:00
                  > >
                  > >
                  >
                • Satyam
                  The URL you are using for the query doesn t seem to format the reply in a way that can be consumed by the ScriptDataSource. As you note, the JSON data should
                  Message 8 of 20 , May 10, 2009
                  • 0 Attachment
                    The URL you are using for the query doesn't seem to format the reply in
                    a way that can be consumed by the ScriptDataSource. As you note, the
                    JSON data should be wrapped in a function call. That depends on the way
                    the service provider decides to implement the service. It seems that
                    sugg.search.yahoo.com does not read the 'fn' argument to find the
                    wrapper for the reply. You should check the documentation of the
                    service to see which argument it uses, if it uses any. Look for
                    documentation for the service you are using and check if it does accept
                    any sort of callback function argument. If it doesn't, then you'll have
                    to use something else, there is nothing you can do on the client side.
                    May I suggest YQL?

                    http://developer.yahoo.com/yql/



                    kennyth01 escribió:
                    >
                    >
                    > Hi satyam,
                    >
                    > Here's the sample code, just copy and paste the code below and save it
                    > in a html format :
                    >
                    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                    > <html xmlns="http://www.w3.org/1999/xhtml">
                    > <head>
                    > <meta http-equiv="Content-Type" content="text/html; " />
                    > <!--CSS file (default YUI Sam Skin) -->
                    > <link type="text/css" rel="stylesheet"
                    > href="http://yui.yahooapis.com/2.7.0/build/autocomplete/assets/skins/sam/autocomplete.css">
                    >
                    > <!-- Dependencies -->
                    > <script type="text/javascript"
                    > src="http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
                    >
                    >
                    > <!-- OPTIONAL: Get (required only if using ScriptNodeDataSource) -->
                    > <script type="text/javascript"
                    > src="http://yui.yahooapis.com/2.7.0/build/get/get-min.js"></script>
                    >
                    > <!-- OPTIONAL: Animation (required only if enabling animation) -->
                    > <script type="text/javascript"
                    > src="http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js"></script>
                    >
                    > <!-- OPTIONAL: JSON (enables JSON validation) -->
                    > <script type="text/javascript"
                    > src="http://yui.yahooapis.com/2.7.0/build/json/json-min.js"></script>
                    >
                    > <!-- Source file -->
                    > <script type="text/javascript"
                    > src="http://yui.yahooapis.com/2.7.0/build/datasource/datasource-min.js"></script>
                    > <script type="text/javascript"
                    > src="http://yui.yahooapis.com/2.7.0/build/connection/connection-min.js"></script>
                    > <script type="text/javascript"
                    > src="http://yui.yahooapis.com/2.7.0/build/autocomplete/autocomplete-min.js"></script>
                    >
                    >
                    > <title>ScriptCallback param Autocomplete/title>
                    > </head>
                    >
                    > <body onload="initialize()">
                    > // An outer container contains an input element and
                    > // a empty results container, both of which are passed
                    > // to the constructor
                    > <div id="myAutoComplete">
                    > <input id="myInput" type="text">
                    > <div id="myContainer"></div>
                    > </div>
                    > </body>
                    >
                    >
                    > <script language="javascript" type="text/javascript">
                    > function initialize () {
                    > var ds = new
                    > YAHOO.util.ScriptNodeDataSource("http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=");
                    > var myAutoComp = new
                    > YAHOO.widget.AutoComplete("myInput","myContainer", ds);
                    >
                    >
                    > myAutoComp.queryDelay = .5;
                    > myAutoComp.maxResultsDisplayed = 10;
                    > myAutoComp.typeAhead = true;
                    >
                    >
                    > ds.scriptCallbackParam = "fn";
                    > ds.responseSchema = {
                    > fields: ["Text"]
                    > };
                    > ds.responseType =
                    > YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                    > myAutoComp.generateRequest = function(sQuery) {
                    > return sQuery;
                    > };
                    > //get only the array of suggestions...
                    > ds.doBeforeParseData = function( oRequest ,
                    > oFullResponse , oCallback ) {
                    > return oFullResponse[1];
                    > };
                    >
                    > return {
                    > oDS: ds,
                    > oAC: myAutoComp
                    > };
                    > }
                    > </script>
                    > </html>
                    >
                    >
                    > Looking at the Net tab of Firefox, the request url generated is :
                    > *http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=d&fn=YAHOO.util.ScriptNodeDataSource.callbacks[0]*
                    > and the response given is:
                    > *["d",["dictionary","disney channel","dell","driving
                    > directions","delta airlines","directions","dom deluise","dancing with
                    > the stars","dish network","dmv"],[],[]]*
                    >
                    >
                    > I think the problem here is that YUI expects the response to be like this:
                    > *YAHOO.util.ScriptNodeDataSource.callbacks[0](["d",["dictionary","disney
                    > channel","dell","driving directions","delta
                    > airlines","directions","dom deluise","dancing with the stars","dish
                    > network","dmv"],[],[]])*
                    > Take note that its wrapped in a callback that is generated by YUI
                    >
                    >
                    > My questions are:
                    >
                    > 1. Is there any other workaround for I to hacked the response and then
                    > passed that to the autocomplete? If so, feel free to modify the code.
                    >
                    > 2. In relation to my 1st question, can I create my own callback
                    > function name and it's possible if YUI can understand that? (e.g the
                    > response would be like):
                    > *myOwnCallback*(["d",["dictionary","disney channel","dell","driving
                    > directions","delta airlines","directions","dom deluise","dancing with
                    > the stars","dish network","dmv"],[],[]])
                    > I think I could create my own callback by overriding the
                    > generateCallback of data source but how will I make it work if YUI
                    > expects the response (I think) with*
                    > YAHOO.util.ScriptNodeDataSource.callbacks[0]* as the callback name.
                    >
                    >
                    > Please see the code above and if possible help me on my problem.
                    > Thanks a lot in advance.
                    >
                    > Regards,
                    > kennyth01
                    >
                    >
                    >
                    >
                    > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
                    > >
                    > > If you can verify this is so, please do file a bug report. The author
                    > > of the component will sure want to know. If you can place a working
                    > > copy of the buggy code to see it fail, that would be great.
                    > >
                    > > Satyam
                    > >
                    > >
                    > > kennyth01 escribió:
                    > > > Thanks satyam! YUI can't seem to worked if you specify a new
                    > callback method name.
                    > > >
                    > > >
                    > > > --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                    > > >
                    > > >>
                    > > >> It looks Ok the way it is. If you use Firefox with Firebug, in
                    > the Net or
                    > > >> Console tabs you will see the actual request and response to your
                    > query.
                    > > >> That might give you a clue as to what is actually going on.
                    > > >>
                    > > >> On Tue, 05 May 2009 12:08:05 -0000, "kennyth01" wrote:
                    > > >>
                    > > >> Hi satyam,
                    > > >>
                    > > >> I'd try overriding doBeforeParseData and it seems to work fine (using
                    > > >> Yahoo URL as the data source). But why is that it doesn't work
                    > when using
                    > > >> other data source feeds? One example is if I use this url feed:
                    > > >> http://ss.ask.com/query?fn=myCallback&sstype=prefix">//Commented out.
                    > > >> //var _yahooDemo =
                    > > >>
                    > "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json
                    > > >>
                    > > >> var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix
                    > > >> var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
                    > > >> var oAC = new YAHOO.widget.AutoComplete("myTextbox",
                    > > >> "autocompleteContainer", oDS);
                    > > >> oAC.queryDelay = .5;
                    > > >> // The webservice needs additional parameters
                    > > >> oAC.generateRequest = function(sQuery) {
                    > > >> return
                    > > >> sQuery;
                    > > >> };
                    > > >>
                    > > >> //IT SHOULD POP A MESSAGE ALERT BUT DOESN'T. IT WORKS IF I CHANGE MY
                    > > >> SOURCE TO _YAHOODEMO.
                    > > >> oDS.doBeforeParseData = function( oRequest , oFullResponse ,
                    > oCallback )
                    > > >> {
                    > > >> alert("I should see this message");
                    > > >> return oFullResponse;
                    > > >> };
                    > > >>
                    > > >> return {
                    > > >> oDS: oDS,
                    > > >> oAC: oAC
                    > > >> };
                    > > >> ....
                    > > >>
                    > > >> function myCallback(oResponse) {
                    > > >> //Here's my callback fn. I can get the response here.
                    > > >> }
                    > > >>
                    > > >> Any ideas on this?
                    > > >>
                    > > >> Regards,
                    > > >> kennyth01
                    > > >>
                    > > >> --- In ydn-javascript@yahoogroups.com, wrote:
                    > > >>
                    > > >>> It is a little complicated, indeed. There is another
                    > alternative, check
                    > > >>> method doBeforeParseDa ta in DataSource. It is function meant to be
                    > > >>> overriden, the one that comes with DataSource does nothing else but
                    > > >>>
                    > > >> return
                    > > >>
                    > > >>> one of the argument it receives untouched. You may, however,
                    > touch it
                    > > >>> anyway you want as long as you return it in more or less the
                    > same shape.
                    > > >>>
                    > > >>> They are documented, both in the user guide for DataSource and
                    > in the
                    > > >>>
                    > > >> API,
                    > > >>
                    > > >>> check it out. doBeforeParseData is executed before any
                    > information is
                    > > >>> parsed so
                    > > >>>
                    > > >> the responseSchema has to reflect the data structure you
                    > > >> return
                    > > >>
                    > > >>> from that function, not the one that function receives in one if its
                    > > >>> arguments. That function is completely synchronous, you won't
                    > need to be
                    > > >>> concerned about timing.
                    > > >>>
                    > > >>> Satyam
                    > > >>>
                    > > >>>
                    > > >>> On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@
                    > > >>> wrote:
                    > > >>>
                    > > >>>> Thanks for the pointers satyam. Does this also mean that I will
                    > create
                    > > >>>>
                    > > >> a
                    > > >>
                    > > >>>> seperate event to just trigger the Connection Manager's
                    > asyncRequest
                    > > >>>>
                    > > >> and
                    > > >>
                    > > >>>> make it as a LocalDataSource then instantiating the
                    > Autocomplete? Does
                    > > >>>> this also mean that the attached event in the autocomplete will be
                    > > >>>> useless?
                    > > >>>>
                    > > >>>> Regards,
                    > > >>>> kennyth01
                    > > >>>>
                    > > >>>>
                    > > >>>> --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                    > > >>>>
                    > > >>>>> Then just use Connection Manager's asyncRequest to fetch the data,
                    > > >>>>>
                    > > >>>> change
                    > > >>>>
                    > > >>>>> it to some suitable format and use a LocalDataSource to read the
                    > > >>>>>
                    > > >>>> processed
                    > > >>>>
                    > > >>>>> result.
                    > > >>>>>
                    > > >>>>> Satyam
                    > > >>>>>
                    > > >>>>> On Mon, 04 May 2009 13:45:29 -0000,
                    > > >>>>>
                    > > >> "kennyth01" kennyth01@
                    > > >>
                    > > >>>>> wrote:
                    > > >>>>>
                    > > >>>>>> Thanks for the explanation Satyam.
                    > > >>>>>> Yup you're right, the structure of the data is totally wrong. But
                    > > >>>>>>
                    > > >> is
                    > > >>
                    > > >>>>> there
                    > > >>>>>
                    > > >>>>>> any workaround to be able to get the second array? How about gett
                    > > >>>>>>
                    > > >> ing
                    > > >>
                    > > >>>> it
                    > > >>>>
                    > > >>>>> and
                    > > >>>>>
                    > > >>>>>> format it in a proper way?
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                    > > >>>>>>
                    > > >>>>>>> As I said, that is not a proper format for what you mean.
                    > Sorry to
                    > > >>>>>>>
                    > > >>>>>> sound
                    > > >>>>>>
                    > > >>>>>>> pedantic but the 'semantics' of your message is wrong. The
                    > > >>>>>>>
                    > > >> structure
                    > > >>
                    > > >>>> of
                    > > >>>>
                    > > >>>>>>> your message does not convey the key:data relationship that you
                    > > >>>>>>>
                    > > >> mean
                    > > >>
                    > > >>>> to
                    > > >>>>
                    > > >>>>>>> express. Both 'fruits' and the array containing the values are
                    > > >>>>>>>
                    > > >>>> simple
                    > > >>>>
                    > > >>>>>>> items in an array, they are siblings, they don't have a
                    > key:values
                    > > >>>>>>> relationship. That's why it is difficult to represent in the
                    > > >>>>>>> responseSchema, because there is no way to express a
                    > relationship
                    > > >>>>>>>
                    > > >>>> that
                    > > >>>>
                    > > >>>>>> does
                    > > >>>>>>
                    > > >>>>>>> not
                    > > >>>>>>>
                    > > >> exist.
                    > > >>
                    > > >>>>>>> Satyam
                    > > >>>>>>>
                    > > >>>>>>>
                    > > >>>>>>> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01"
                    > > >>>>>>> wrote:
                    > > >>>>>>>
                    > > >>>>>>>> Thanks Satyam! I'll try this one out. But how about if I'm not
                    > > >>>>>>>>
                    > > >>>> using
                    > > >>>>
                    > > >>>>>>>> LocalDataSource? For example, I will use a script node:
                    > > >>>>>>>>
                    > > >>>>>>>> var oDS = new
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>
                    > YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback
                    > > >>
                    > > >>>>>>>> and the URL gives a response of :
                    > > >>>>>>>> myCallback(['fruits',['g uava','mango','carrots']])
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>> How will I map this response to only get/display guava, mango
                    > > >>>>>>>>
                    > > >> and
                    > > >>
                    > > >>>>>> carrots
                    > > >>>>>>
                    > > >>>>>>>> on the list(autocomplete).
                    > > >>>>>>>>
                    > > >>>>>>>> Any idea on how is it on responseSchema? Thanks!
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                    > > >>>>>>>>
                    > > >>>>>>>>>
                    > > >>>>>>>>> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
                    > > >>>>>>>>>
                    > > >>>>>>>>> Hi
                    > > >>>>>>>>>
                    > > >> masters,
                    > > >>
                    > > >>>>>>>>> I have a problem getting results on an array data. Here's the
                    > > >>>>>>>>>
                    > > >>>>>> snippet:
                    > > >>>>>>
                    > > >>>>>>>>> ...
                    > > >>>>>>>>>
                    > > >>>>>>>>> var data = ['fruits',['guava','mango','carrots']];
                    > > >>>>>>>>>
                    > > >>>>>>>>> var oDS = new YAHOO.util.LocalDataSource(data);
                    > > >>>>>>>>> You can change the line above to: var oDS = new
                    > > >>>>>>>>> YAHOO.util.LocalDataSource(data[1]); and then forget about
                    > > >>>>>>>>>
                    > > >>>>>> resultsList.
                    > > >>>>>>
                    > > >>>>>>>>> However,I think that what you want in that array above is more
                    > > >>>>>>>>>
                    > > >>>> like:
                    > > >>>>
                    > > >>>>>>>>> {'fruits':['guave','mang','carrots']} Otherwise, the second
                    > > >>>>>>>>>
                    > > >> item
                    > > >>
                    > > >>>> in
                    > > >>>>
                    > > >>>>>> the
                    > > >>>>>>
                    > > >>>>>>>>> array has no relation whatsoever to the first element
                    > > >>>>>>>>> Satyam
                    > > >>>>>>>>>
                    > > >>>>>>>>> oDS.responseType =
                    > > >>>>>>>>>
                    > > >> YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                    > > >>
                    > > >>>>>>>>> //I believe my mapping is wrong? Help me map on this please.
                    > > >>>>>>>>> oDS.responseSchema = {
                    > > >>>>>>>>> resultsList: ["Fruits"],
                    > > >>>>>>>>> fields : ["Label"]
                    > > >>>>>>>>> };
                    > > >>>>>>>>> oAC = new
                    > > >>>>>>>>>
                    > > >> YAHOO.widget.AutoComplete("sttop",
                    > > >>
                    > > >>>> "autocompleteContainer",
                    > > >>>>
                    > > >>>>>>>>> oDS);
                    > > >>>>>>>>> oAC.queryDelay = .5;
                    > > >>>>>>>>>
                    > > >>>>>>>>> //How do I format it when I only want to display are list of
                    > > >>>>>>>>>
                    > > >>>> fruits?
                    > > >>>>
                    > > >>>>>>>>> oAC.formatResult = function(oResultItem, sQuery) {
                    > > >>>>>>>>>
                    > > >>>>>>>>> return "_" + oResultItem[0] + "_";
                    > > >>>>>>>>> };
                    > > >>>>>>>>>
                    > > >>>>>>>>> return {
                    > > >>>>>>>>> oDS: oDS,
                    > > >>>>>>>>> oAC: oAC
                    > > >>>>>>>>> };
                    > > >>>>>>>>>
                    > > >>>>>>>>> Hoping someone will help me on this. Thanks!
                    > > >>>>>>>>>
                    > > >>>>>>>>>
                    > > >>>>>>>>>
                    > > >>>>>>>>> Links:
                    > > >>>>>>>>> ------
                    > > >>>>>>>>> [1]
                    > > >>>>>>>>>
                    > > >>>>>>>>>
                    > > >>
                    > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
                    > > >>
                    > > >>>>>>>>> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                    > > >>>>>>>>>
                    > > >>>>> ; > Delivery:
                    > > >>>>>
                    > > >>>>>>>>> Digest
                    > > >>>>>>>>> [3]
                    > > >>>>>>>>>
                    > > >> mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                    > > >>
                    > > >>>>>>>>> Delivery Format: Fully
                    > > >>>>>>>>> Featured
                    > > >>>>>>>>> [4]
                    > > >>>>>>>>>
                    > > >>>>>>>>>
                    > > >>
                    > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
                    > > >>
                    > > >>>>>>>>> [5] http://docs.yahoo.com/info/terms/
                    > > >>>>>>>>> [6]
                    > > >>>>>>>>>
                    > > >>>>
                    > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                    > > >>>>
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>> ------------------------------------
                    > > >>>>>>>>
                    > > >>>>>>>> Yahoo! Groups Links
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>>>
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>> ------------------------------------
                    > > >>>>>>
                    > > >>>>>> Yahoo! Groups Links
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>>>
                    > > >>>>
                    > > >>>>
                    > > >>>> ------------------------------------
                    > > >>>>
                    > > >>>> Yahoo! Groups Links
                    > > >>>>
                    > > >>>>
                    > > >>>>
                    > > >>>>
                    > > >>
                    > > >>
                    > > >> Links:
                    > > >> ------
                    > > >> [1]
                    > > >>
                    > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnb21sNGRyBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNTI1MzUz
                    > > >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                    > Delivery:
                    > > >> Digest
                    > > >> [3] mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                    > > >> Delivery Format: Fully Featured
                    > > >> [4]
                    > > >>
                    > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJlOThha2poBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTUyNTM1Mw--
                    > > >> [5] http://docs.yahoo.com/info/terms/
                    > > >> [6]
                    > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                    > > >>
                    > > >>
                    > > >
                    > > >
                    > > >
                    > > >
                    > > > ------------------------------------
                    > > >
                    > > > Yahoo! Groups Links
                    > > >
                    > > >
                    > > >
                    > > >
                    > ------------------------------------------------------------------------
                    > > >
                    > > >
                    > > > No virus found in this incoming message.
                    > > > Checked by AVG - www.avg.com
                    > > > Version: 8.5.287 / Virus Database: 270.12.21/2104 - Release Date:
                    > 05/08/09 06:34:00
                    > > >
                    > > >
                    > >
                    >
                    >
                    >
                    > ------------------------------------------------------------------------
                    >
                    >
                    > No virus found in this incoming message.
                    > Checked by AVG - www.avg.com
                    > Version: 8.5.325 / Virus Database: 270.12.23/2106 - Release Date: 05/09/09 06:54:00
                    >
                    >
                  • kennyth01
                    YQL seems better! Thanks for that! :D However, how about if the feed do support callback function argument but the function name is restricted from renaming.
                    Message 9 of 20 , May 11, 2009
                    • 0 Attachment
                      YQL seems better! Thanks for that!  :D

                      However, how about if the feed do support callback function argument but the function name is restricted from renaming. For example: http://sugg.search.yahoo.net/sg/?output=jsonp&nresults=10&command=a

                      This url feed will return:
                      fxsearch(["a",["amazon","ask jeeves","aol","american idol","autotrader","american airlines","argos","angelina jolie","american express","amtrak"],[],[]])

                      The feed is now wrap in a function but the autocomplete of YUI isn't working because it expects YAHOO.util.ScriptNodeDataSource.callbacks[0] as the function name, right? I tried calling the YAHOO.util.ScriptNodeDataSource.callbacks[0] method in the fxsearch callback method but I was getting some nasty errors. Is there any chance for it? Thanks in advance.




                      --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
                      >
                      > The URL you are using for the query doesn't seem to format the reply in
                      > a way that can be consumed by the ScriptDataSource. As you note, the
                      > JSON data should be wrapped in a function call. That depends on the way
                      > the service provider decides to implement the service. It seems that
                      > sugg.search.yahoo.com does not read the 'fn' argument to find the
                      > wrapper for the reply. You should check the documentation of the
                      > service to see which argument it uses, if it uses any. Look for
                      > documentation for the service you are using and check if it does accept
                      > any sort of callback function argument. If it doesn't, then you'll have
                      > to use something else, there is nothing you can do on the client side.
                      > May I suggest YQL?
                      >
                      > http://developer.yahoo.com/yql/
                      >
                      >
                      >
                      > kennyth01 escribió:
                      > >
                      > >
                      > > Hi satyam,
                      > >
                      > > Here's the sample code, just copy and paste the code below and save it
                      > > in a html format :
                      > >
                      > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                      > > <html xmlns="http://www.w3.org/1999/xhtml">
                      > > <head>
                      > > <meta http-equiv="Content-Type" content="text/html; " />
                      > > <!--CSS file (default YUI Sam Skin) -->
                      > > <link type="text/css" rel="stylesheet"
                      > > href="http://yui.yahooapis.com/2.7.0/build/autocomplete/assets/skins/sam/autocomplete.css">
                      > >
                      > > <!-- Dependencies -->
                      > > <script type="text/javascript"
                      > > src="http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
                      > >
                      > >
                      > > <!-- OPTIONAL: Get (required only if using ScriptNodeDataSource) -->
                      > > <script type="text/javascript"
                      > > src="http://yui.yahooapis.com/2.7.0/build/get/get-min.js"></script>
                      > >
                      > > <!-- OPTIONAL: Animation (required only if enabling animation) -->
                      > > <script type="text/javascript"
                      > > src="http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js"></script>
                      > >
                      > > <!-- OPTIONAL: JSON (enables JSON validation) -->
                      > > <script type="text/javascript"
                      > > src="http://yui.yahooapis.com/2.7.0/build/json/json-min.js"></script>
                      > >
                      > > <!-- Source file -->
                      > > <script type="text/javascript"
                      > > src="http://yui.yahooapis.com/2.7.0/build/datasource/datasource-min.js"></script>
                      > > <script type="text/javascript"
                      > > src="http://yui.yahooapis.com/2.7.0/build/connection/connection-min.js"></script>
                      > > <script type="text/javascript"
                      > > src="http://yui.yahooapis.com/2.7.0/build/autocomplete/autocomplete-min.js"></script>
                      > >
                      > >
                      > > <title>ScriptCallback param Autocomplete/title>
                      > > </head>
                      > >
                      > > <body onload="initialize()">
                      > > // An outer container contains an input element and
                      > > // a empty results container, both of which are passed
                      > > // to the constructor
                      > > <div id="myAutoComplete">
                      > > <input id="myInput" type="text">
                      > > <div id="myContainer"></div>
                      > > </div>
                      > > </body>
                      > >
                      > >
                      > > <script language="javascript" type="text/javascript">
                      > > function initialize () {
                      > > var ds = new
                      > > YAHOO.util.ScriptNodeDataSource("http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=");
                      > > var myAutoComp = new
                      > > YAHOO.widget.AutoComplete("myInput","myContainer", ds);
                      > >
                      > >
                      > > myAutoComp.queryDelay = .5;
                      > > myAutoComp.maxResultsDisplayed = 10;
                      > > myAutoComp.typeAhead = true;
                      > >
                      > >
                      > > ds.scriptCallbackParam = "fn";
                      > > ds.responseSchema = {
                      > > fields: ["Text"]
                      > > };
                      > > ds.responseType =
                      > > YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                      > > myAutoComp.generateRequest = function(sQuery) {
                      > > return sQuery;
                      > > };
                      > > //get only the array of suggestions...
                      > > ds.doBeforeParseData = function( oRequest ,
                      > > oFullResponse , oCallback ) {
                      > > return oFullResponse[1];
                      > > };
                      > >
                      > > return {
                      > > oDS: ds,
                      > > oAC: myAutoComp
                      > > };
                      > > }
                      > > </script>
                      > > </html>
                      > >
                      > >
                      > > Looking at the Net tab of Firefox, the request url generated is :
                      > > *http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=d&fn=YAHOO.util.ScriptNodeDataSource.callbacks[0]*
                      > > and the response given is:
                      > > *["d",["dictionary","disney channel","dell","driving
                      > > directions","delta airlines","directions","dom deluise","dancing with
                      > > the stars","dish network","dmv"],[],[]]*
                      > >
                      > >
                      > > I think the problem here is that YUI expects the response to be like this:
                      > > *YAHOO.util.ScriptNodeDataSource.callbacks[0](["d",["dictionary","disney
                      > > channel","dell","driving directions","delta
                      > > airlines","directions","dom deluise","dancing with the stars","dish
                      > > network","dmv"],[],[]])*
                      > > Take note that its wrapped in a callback that is generated by YUI
                      > >
                      > >
                      > > My questions are:
                      > >
                      > > 1. Is there any other workaround for I to hacked the response and then
                      > > passed that to the autocomplete? If so, feel free to modify the code.
                      > >
                      > > 2. In relation to my 1st question, can I create my own callback
                      > > function name and it's possible if YUI can understand that? (e.g the
                      > > response would be like):
                      > > *myOwnCallback*(["d",["dictionary","disney channel","dell","driving
                      > > directions","delta airlines","directions","dom deluise","dancing with
                      > > the stars","dish network","dmv"],[],[]])
                      > > I think I could create my own callback by overriding the
                      > > generateCallback of data source but how will I make it work if YUI
                      > > expects the response (I think) with*
                      > > YAHOO.util.ScriptNodeDataSource.callbacks[0]* as the callback name.
                      > >
                      > >
                      > > Please see the code above and if possible help me on my problem.
                      > > Thanks a lot in advance.
                      > >
                      > > Regards,
                      > > kennyth01
                      > >
                      > >
                      > >
                      > >
                      > > --- In ydn-javascript@yahoogroups.com, Satyam satyam@ wrote:
                      > > >
                      > > > If you can verify this is so, please do file a bug report. The author
                      > > > of the component will sure want to know. If you can place a working
                      > > > copy of the buggy code to see it fail, that would be great.
                      > > >
                      > > > Satyam
                      > > >
                      > > >
                      > > > kennyth01 escribió:
                      > > > > Thanks satyam! YUI can't seem to worked if you specify a new
                      > > callback method name.
                      > > > >
                      > > > >
                      > > > > --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                      > > > >
                      > > > >>
                      > > > >> It looks Ok the way it is. If you use Firefox with Firebug, in
                      > > the Net or
                      > > > >> Console tabs you will see the actual request and response to your
                      > > query.
                      > > > >> That might give you a clue as to what is actually going on.
                      > > > >>
                      > > > >> On Tue, 05 May 2009 12:08:05 -0000, "kennyth01" wrote:
                      > > > >>
                      > > > >> Hi satyam,
                      > > > >>
                      > > > >> I'd try overriding doBeforeParseData and it seems to work fine (using
                      > > > >> Yahoo URL as the data source). But why is that it doesn't work
                      > > when using
                      > > > >> other data source feeds? One example is if I use this url feed:
                      > > > >> http://ss.ask.com/query?fn=myCallback&sstype=prefix">//Commented out.
                      > > > >> //var _yahooDemo =
                      > > > >>
                      > > "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json
                      > > > >>
                      > > > >> var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix
                      > > > >> var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
                      > > > >> var oAC = new YAHOO.widget.AutoComplete("myTextbox",
                      > > > >> "autocompleteContainer", oDS);
                      > > > >> oAC.queryDelay = .5;
                      > > > >> // The webservice needs additional parameters
                      > > > >> oAC.generateRequest = function(sQuery) {
                      > > > >> return
                      > > > >> sQuery;
                      > > > >> };
                      > > > >>
                      > > > >> //IT SHOULD POP A MESSAGE ALERT BUT DOESN'T. IT WORKS IF I CHANGE MY
                      > > > >> SOURCE TO _YAHOODEMO.
                      > > > >> oDS.doBeforeParseData = function( oRequest , oFullResponse ,
                      > > oCallback )
                      > > > >> {
                      > > > >> alert("I should see this message");
                      > > > >> return oFullResponse;
                      > > > >> };
                      > > > >>
                      > > > >> return {
                      > > > >> oDS: oDS,
                      > > > >> oAC: oAC
                      > > > >> };
                      > > > >> ....
                      > > > >>
                      > > > >> function myCallback(oResponse) {
                      > > > >> //Here's my callback fn. I can get the response here.
                      > > > >> }
                      > > > >>
                      > > > >> Any ideas on this?
                      > > > >>
                      > > > >> Regards,
                      > > > >> kennyth01
                      > > > >>
                      > > > >> --- In ydn-javascript@yahoogroups.com, wrote:
                      > > > >>
                      > > > >>> It is a little complicated, indeed. There is another
                      > > alternative, check
                      > > > >>> method doBeforeParseDa ta in DataSource. It is function meant to be
                      > > > >>> overriden, the one that comes with DataSource does nothing else but
                      > > > >>>
                      > > > >> return
                      > > > >>
                      > > > >>> one of the argument it receives untouched. You may, however,
                      > > touch it
                      > > > >>> anyway you want as long as you return it in more or less the
                      > > same shape.
                      > > > >>>
                      > > > >>> They are documented, both in the user guide for DataSource and
                      > > in the
                      > > > >>>
                      > > > >> API,
                      > > > >>
                      > > > >>> check it out. doBeforeParseData is executed before any
                      > > information is
                      > > > >>> parsed so
                      > > > >>>
                      > > > >> the responseSchema has to reflect the data structure you
                      > > > >> return
                      > > > >>
                      > > > >>> from that function, not the one that function receives in one if its
                      > > > >>> arguments. That function is completely synchronous, you won't
                      > > need to be
                      > > > >>> concerned about timing.
                      > > > >>>
                      > > > >>> Satyam
                      > > > >>>
                      > > > >>>
                      > > > >>> On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@
                      > > > >>> wrote:
                      > > > >>>
                      > > > >>>> Thanks for the pointers satyam. Does this also mean that I will
                      > > create
                      > > > >>>>
                      > > > >> a
                      > > > >>
                      > > > >>>> seperate event to just trigger the Connection Manager's
                      > > asyncRequest
                      > > > >>>>
                      > > > >> and
                      > > > >>
                      > > > >>>> make it as a LocalDataSource then instantiating the
                      > > Autocomplete? Does
                      > > > >>>> this also mean that the attached event in the autocomplete will be
                      > > > >>>> useless?
                      > > > >>>>
                      > > > >>>> Regards,
                      > > > >>>> kennyth01
                      > > > >>>>
                      > > > >>>>
                      > > > >>>> --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                      > > > >>>>
                      > > > >>>>> Then just use Connection Manager's asyncRequest to fetch the data,
                      > > > >>>>>
                      > > > >>>> change
                      > > > >>>>
                      > > > >>>>> it to some suitable format and use a LocalDataSource to read the
                      > > > >>>>>
                      > > > >>>> processed
                      > > > >>>>
                      > > > >>>>> result.
                      > > > >>>>>
                      > > > >>>>> Satyam
                      > > > >>>>>
                      > > > >>>>> On Mon, 04 May 2009 13:45:29 -0000,
                      > > > >>>>>
                      > > > >> "kennyth01" kennyth01@
                      > > > >>
                      > > > >>>>> wrote:
                      > > > >>>>>
                      > > > >>>>>> Thanks for the explanation Satyam.
                      > > > >>>>>> Yup you're right, the structure of the data is totally wrong. But
                      > > > >>>>>>
                      > > > >> is
                      > > > >>
                      > > > >>>>> there
                      > > > >>>>>
                      > > > >>>>>> any workaround to be able to get the second array? How about gett
                      > > > >>>>>>
                      > > > >> ing
                      > > > >>
                      > > > >>>> it
                      > > > >>>>
                      > > > >>>>> and
                      > > > >>>>>
                      > > > >>>>>> format it in a proper way?
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                      > > > >>>>>>
                      > > > >>>>>>> As I said, that is not a proper format for what you mean.
                      > > Sorry to
                      > > > >>>>>>>
                      > > > >>>>>> sound
                      > > > >>>>>>
                      > > > >>>>>>> pedantic but the 'semantics' of your message is wrong. The
                      > > > >>>>>>>
                      > > > >> structure
                      > > > >>
                      > > > >>>> of
                      > > > >>>>
                      > > > >>>>>>> your message does not convey the key:data relationship that you
                      > > > >>>>>>>
                      > > > >> mean
                      > > > >>
                      > > > >>>> to
                      > > > >>>>
                      > > > >>>>>>> express. Both 'fruits' and the array containing the values are
                      > > > >>>>>>>
                      > > > >>>> simple
                      > > > >>>>
                      > > > >>>>>>> items in an array, they are siblings, they don't have a
                      > > key:values
                      > > > >>>>>>> relationship. That's why it is difficult to represent in the
                      > > > >>>>>>> responseSchema, because there is no way to express a
                      > > relationship
                      > > > >>>>>>>
                      > > > >>>> that
                      > > > >>>>
                      > > > >>>>>> does
                      > > > >>>>>>
                      > > > >>>>>>> not
                      > > > >>>>>>>
                      > > > >> exist.
                      > > > >>
                      > > > >>>>>>> Satyam
                      > > > >>>>>>>
                      > > > >>>>>>>
                      > > > >>>>>>> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01"
                      > > > >>>>>>> wrote:
                      > > > >>>>>>>
                      > > > >>>>>>>> Thanks Satyam! I'll try this one out. But how about if I'm not
                      > > > >>>>>>>>
                      > > > >>>> using
                      > > > >>>>
                      > > > >>>>>>>> LocalDataSource? For example, I will use a script node:
                      > > > >>>>>>>>
                      > > > >>>>>>>> var oDS = new
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>
                      > > YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback
                      > > > >>
                      > > > >>>>>>>> and the URL gives a response of :
                      > > > >>>>>>>> myCallback(['fruits',['g uava','mango','carrots']])
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>> How will I map this response to only get/display guava, mango
                      > > > >>>>>>>>
                      > > > >> and
                      > > > >>
                      > > > >>>>>> carrots
                      > > > >>>>>>
                      > > > >>>>>>>> on the list(autocomplete).
                      > > > >>>>>>>>
                      > > > >>>>>>>> Any idea on how is it on responseSchema? Thanks!
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                      > > > >>>>>>>>
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> Hi
                      > > > >>>>>>>>>
                      > > > >> masters,
                      > > > >>
                      > > > >>>>>>>>> I have a problem getting results on an array data. Here's the
                      > > > >>>>>>>>>
                      > > > >>>>>> snippet:
                      > > > >>>>>>
                      > > > >>>>>>>>> ...
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> var data = ['fruits',['guava','mango','carrots']];
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> var oDS = new YAHOO.util.LocalDataSource(data);
                      > > > >>>>>>>>> You can change the line above to: var oDS = new
                      > > > >>>>>>>>> YAHOO.util.LocalDataSource(data[1]); and then forget about
                      > > > >>>>>>>>>
                      > > > >>>>>> resultsList.
                      > > > >>>>>>
                      > > > >>>>>>>>> However,I think that what you want in that array above is more
                      > > > >>>>>>>>>
                      > > > >>>> like:
                      > > > >>>>
                      > > > >>>>>>>>> {'fruits':['guave','mang','carrots']} Otherwise, the second
                      > > > >>>>>>>>>
                      > > > >> item
                      > > > >>
                      > > > >>>> in
                      > > > >>>>
                      > > > >>>>>> the
                      > > > >>>>>>
                      > > > >>>>>>>>> array has no relation whatsoever to the first element
                      > > > >>>>>>>>> Satyam
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> oDS.responseType =
                      > > > >>>>>>>>>
                      > > > >> YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                      > > > >>
                      > > > >>>>>>>>> //I believe my mapping is wrong? Help me map on this please.
                      > > > >>>>>>>>> oDS.responseSchema = {
                      > > > >>>>>>>>> resultsList: ["Fruits"],
                      > > > >>>>>>>>> fields : ["Label"]
                      > > > >>>>>>>>> };
                      > > > >>>>>>>>> oAC = new
                      > > > >>>>>>>>>
                      > > > >> YAHOO.widget.AutoComplete("sttop",
                      > > > >>
                      > > > >>>> "autocompleteContainer",
                      > > > >>>>
                      > > > >>>>>>>>> oDS);
                      > > > >>>>>>>>> oAC.queryDelay = .5;
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> //How do I format it when I only want to display are list of
                      > > > >>>>>>>>>
                      > > > >>>> fruits?
                      > > > >>>>
                      > > > >>>>>>>>> oAC.formatResult = function(oResultItem, sQuery) {
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> return "_" + oResultItem[0] + "_";
                      > > > >>>>>>>>> };
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> return {
                      > > > >>>>>>>>> oDS: oDS,
                      > > > >>>>>>>>> oAC: oAC
                      > > > >>>>>>>>> };
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> Hoping someone will help me on this. Thanks!
                      > > > >>>>>>>>>
                      > > > >>>>>>>>>
                      > > > >>>>>>>>>
                      > > > >>>>>>>>> Links:
                      > > > >>>>>>>>> ------
                      > > > >>>>>>>>> [1]
                      > > > >>>>>>>>>
                      > > > >>>>>>>>>
                      > > > >>
                      > > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
                      > > > >>
                      > > > >>>>>>>>> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                      > > > >>>>>>>>>
                      > > > >>>>> ; > Delivery:
                      > > > >>>>>
                      > > > >>>>>>>>> Digest
                      > > > >>>>>>>>> [3]
                      > > > >>>>>>>>>
                      > > > >> mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                      > > > >>
                      > > > >>>>>>>>> Delivery Format: Fully
                      > > > >>>>>>>>> Featured
                      > > > >>>>>>>>> [4]
                      > > > >>>>>>>>>
                      > > > >>>>>>>>>
                      > > > >>
                      > > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
                      > > > >>
                      > > > >>>>>>>>> [5] http://docs.yahoo.com/info/terms/
                      > > > >>>>>>>>> [6]
                      > > > >>>>>>>>>
                      > > > >>>>
                      > > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                      > > > >>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>> ------------------------------------
                      > > > >>>>>>>>
                      > > > >>>>>>>> Yahoo! Groups Links
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>>>
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>> ------------------------------------
                      > > > >>>>>>
                      > > > >>>>>> Yahoo! Groups Links
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>>>
                      > > > >>>>
                      > > > >>>>
                      > > > >>>> ------------------------------------
                      > > > >>>>
                      > > > >>>> Yahoo! Groups Links
                      > > > >>>>
                      > > > >>>>
                      > > > >>>>
                      > > > >>>>
                      > > > >>
                      > > > >>
                      > > > >> Links:
                      > > > >> ------
                      > > > >> [1]
                      > > > >>
                      > > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnb21sNGRyBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNTI1MzUz
                      > > > >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                      > > Delivery:
                      > > > >> Digest
                      > > > >> [3] mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                      > > > >> Delivery Format: Fully Featured
                      > > > >> [4]
                      > > > >>
                      > > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJlOThha2poBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTUyNTM1Mw--
                      > > > >> [5] http://docs.yahoo.com/info/terms/
                      > > > >> [6]
                      > > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                      > > > >>
                      > > > >>
                      > > > >
                      > > > >
                      > > > >
                      > > > >
                      > > > > ------------------------------------
                      > > > >
                      > > > > Yahoo! Groups Links
                      > > > >
                      > > > >
                      > > > >
                      > > > >
                      > > ------------------------------------------------------------------------
                      > > > >
                      > > > >
                      > > > > No virus found in this incoming message.
                      > > > > Checked by AVG - www.avg.com
                      > > > > Version: 8.5.287 / Virus Database: 270.12.21/2104 - Release Date:
                      > > 05/08/09 06:34:00
                      > > > >
                      > > > >
                      > > >
                      > >
                      > >
                      > >
                      > > ------------------------------------------------------------------------
                      > >
                      > >
                      > > No virus found in this incoming message.
                      > > Checked by AVG - www.avg.com
                      > > Version: 8.5.325 / Virus Database: 270.12.23/2106 - Release Date: 05/09/09 06:54:00
                      > >
                      > >
                      >
                    • Satyam
                      If it is not documented how can you tell the server to change that fxsearch for something else, you are probably better forgetting it. The other alternative
                      Message 10 of 20 , May 11, 2009
                      • 0 Attachment
                        If it is not documented how can you tell the server to change that
                        fxsearch for something else, you are probably better forgetting it. The
                        other alternative is to use the Get utility directly, where you have
                        more control over the communication, and then use a LocalDataSource to
                        read whatever you got. I'm not sure if it is worth the trouble.

                        Satyam


                        kennyth01 escribió:
                        >
                        >
                        > YQL seems better! Thanks for that! :D
                        >
                        > However, how about if the feed do support callback function argument
                        > but the function name is restricted from renaming. For example:
                        > *http://sugg.search.yahoo.net/sg/?output=jsonp&nresults=10&command=a*
                        >
                        > This url feed will return:
                        > *fxsearch*/*(["a",["amazon","ask jeeves","aol","american
                        > idol","autotrader","american airlines","argos","angelina
                        > jolie","american express","amtrak"],[],[]])*/
                        >
                        > The feed is now wrap in a function but the autocomplete of YUI isn't
                        > working because it expects
                        > *YAHOO.util.ScriptNodeDataSource.callbacks[0] *as the function name,
                        > right? I tried calling the
                        > *YAHOO.util.ScriptNodeDataSource.callbacks[0]* method in the
                        > *fxsearch* callback method but I was getting some nasty errors. Is
                        > there any chance for it? Thanks in advance.
                        >
                        >
                        >
                        >
                        > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
                        > >
                        > > The URL you are using for the query doesn't seem to format the reply in
                        > > a way that can be consumed by the ScriptDataSource. As you note, the
                        > > JSON data should be wrapped in a function call. That depends on the way
                        > > the service provider decides to implement the service. It seems that
                        > > sugg.search.yahoo.com does not read the 'fn' argument to find the
                        > > wrapper for the reply. You should check the documentation of the
                        > > service to see which argument it uses, if it uses any. Look for
                        > > documentation for the service you are using and check if it does accept
                        > > any sort of callback function argument. If it doesn't, then you'll have
                        > > to use something else, there is nothing you can do on the client side.
                        > > May I suggest YQL?
                        > >
                        > > http://developer.yahoo.com/yql/
                        > >
                        > >
                        > >
                        > > kennyth01 escribió:
                        > > >
                        > > >
                        > > > Hi satyam,
                        > > >
                        > > > Here's the sample code, just copy and paste the code below and
                        > save it
                        > > > in a html format :
                        > > >
                        > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                        > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                        > > > <html xmlns="http://www.w3.org/1999/xhtml">
                        > > > <head>
                        > > > <meta http-equiv="Content-Type" content="text/html; " />
                        > > > <!--CSS file (default YUI Sam Skin) -->
                        > > > <link type="text/css" rel="stylesheet"
                        > > >
                        > href="http://yui.yahooapis.com/2.7.0/build/autocomplete/assets/skins/sam/autocomplete.css">
                        > > >
                        > > > <!-- Dependencies -->
                        > > > <script type="text/javascript"
                        > > >
                        > src="http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
                        > > >
                        > > >
                        > > > <!-- OPTIONAL: Get (required only if using ScriptNodeDataSource) -->
                        > > > <script type="text/javascript"
                        > > > src="http://yui.yahooapis.com/2.7.0/build/get/get-min.js"></script>
                        > > >
                        > > > <!-- OPTIONAL: Animation (required only if enabling animation) -->
                        > > > <script type="text/javascript"
                        > > >
                        > src="http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js"></script>
                        > > >
                        > > > <!-- OPTIONAL: JSON (enables JSON validation) -->
                        > > > <script type="text/javascript"
                        > > > src="http://yui.yahooapis.com/2.7.0/build/json/json-min.js"></script>
                        > > >
                        > > > <!-- Source file -->
                        > > > <script type="text/javascript"
                        > > >
                        > src="http://yui.yahooapis.com/2.7.0/build/datasource/datasource-min.js"></script>
                        > > > <script type="text/javascript"
                        > > >
                        > src="http://yui.yahooapis.com/2.7.0/build/connection/connection-min.js"></script>
                        > > > <script type="text/javascript"
                        > > >
                        > src="http://yui.yahooapis.com/2.7.0/build/autocomplete/autocomplete-min.js"></script>
                        > > >
                        > > >
                        > > > <title>ScriptCallback param Autocomplete/title>
                        > > > </head>
                        > > >
                        > > > <body onload="initialize()">
                        > > > // An outer container contains an input element and
                        > > > // a empty results container, both of which are passed
                        > > > // to the constructor
                        > > > <div id="myAutoComplete">
                        > > > <input id="myInput" type="text">
                        > > > <div id="myContainer"></div>
                        > > > </div>
                        > > > </body>
                        > > >
                        > > >
                        > > > <script language="javascript" type="text/javascript">
                        > > > function initialize () {
                        > > > var ds = new
                        > > >
                        > YAHOO.util.ScriptNodeDataSource("http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=");
                        > > > var myAutoComp = new
                        > > > YAHOO.widget.AutoComplete("myInput","myContainer", ds);
                        > > >
                        > > >
                        > > > myAutoComp.queryDelay = .5;
                        > > > myAutoComp.maxResultsDisplayed = 10;
                        > > > myAutoComp.typeAhead = true;
                        > > >
                        > > >
                        > > > ds.scriptCallbackParam = "fn";
                        > > > ds.responseSchema = {
                        > > > fields: ["Text"]
                        > > > };
                        > > > ds.responseType =
                        > > > YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                        > > > myAutoComp.generateRequest = function(sQuery) {
                        > > > return sQuery;
                        > > > };
                        > > > //get only the array of suggestions...
                        > > > ds.doBeforeParseData = function( oRequest ,
                        > > > oFullResponse , oCallback ) {
                        > > > return oFullResponse[1];
                        > > > };
                        > > >
                        > > > return {
                        > > > oDS: ds,
                        > > > oAC: myAutoComp
                        > > > };
                        > > > }
                        > > > </script>
                        > > > </html>
                        > > >
                        > > >
                        > > > Looking at the Net tab of Firefox, the request url generated is :
                        > > >
                        > *http://sugg.search.yahoo.com/sg/?output=fxjson&nresults=100&command=d&fn=YAHOO.util.ScriptNodeDataSource.callbacks[0]*
                        > > > and the response given is:
                        > > > *["d",["dictionary","disney channel","dell","driving
                        > > > directions","delta airlines","directions","dom deluise","dancing with
                        > > > the stars","dish network","dmv"],[],[]]*
                        > > >
                        > > >
                        > > > I think the problem here is that YUI expects the response to be
                        > like this:
                        > > >
                        > *YAHOO.util.ScriptNodeDataSource.callbacks[0](["d",["dictionary","disney
                        > > > channel","dell","driving directions","delta
                        > > > airlines","directions","dom deluise","dancing with the stars","dish
                        > > > network","dmv"],[],[]])*
                        > > > Take note that its wrapped in a callback that is generated by YUI
                        > > >
                        > > >
                        > > > My questions are:
                        > > >
                        > > > 1. Is there any other workaround for I to hacked the response and
                        > then
                        > > > passed that to the autocomplete? If so, feel free to modify the code.
                        > > >
                        > > > 2. In relation to my 1st question, can I create my own callback
                        > > > function name and it's possible if YUI can understand that? (e.g the
                        > > > response would be like):
                        > > > *myOwnCallback*(["d",["dictionary","disney channel","dell","driving
                        > > > directions","delta airlines","directions","dom deluise","dancing with
                        > > > the stars","dish network","dmv"],[],[]])
                        > > > I think I could create my own callback by overriding the
                        > > > generateCallback of data source but how will I make it work if YUI
                        > > > expects the response (I think) with*
                        > > > YAHOO.util.ScriptNodeDataSource.callbacks[0]* as the callback name.
                        > > >
                        > > >
                        > > > Please see the code above and if possible help me on my problem.
                        > > > Thanks a lot in advance.
                        > > >
                        > > > Regards,
                        > > > kennyth01
                        > > >
                        > > >
                        > > >
                        > > >
                        > > > --- In ydn-javascript@yahoogroups.com, Satyam satyam@ wrote:
                        > > > >
                        > > > > If you can verify this is so, please do file a bug report. The
                        > author
                        > > > > of the component will sure want to know. If you can place a working
                        > > > > copy of the buggy code to see it fail, that would be great.
                        > > > >
                        > > > > Satyam
                        > > > >
                        > > > >
                        > > > > kennyth01 escribió:
                        > > > > > Thanks satyam! YUI can't seem to worked if you specify a new
                        > > > callback method name.
                        > > > > >
                        > > > > >
                        > > > > > --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                        > > > > >
                        > > > > >>
                        > > > > >> It looks Ok the way it is. If you use Firefox with Firebug, in
                        > > > the Net or
                        > > > > >> Console tabs you will see the actual request and response to
                        > your
                        > > > query.
                        > > > > >> That might give you a clue as to what is actually going on.
                        > > > > >>
                        > > > > >> On Tue, 05 May 2009 12:08:05 -0000, "kennyth01" wrote:
                        > > > > >>
                        > > > > >> Hi satyam,
                        > > > > >>
                        > > > > >> I'd try overriding doBeforeParseData and it seems to work
                        > fine (using
                        > > > > >> Yahoo URL as the data source). But why is that it doesn't work
                        > > > when using
                        > > > > >> other data source feeds? One example is if I use this url feed:
                        > > > > >>
                        > http://ss.ask.com/query?fn=myCallback&sstype=prefix">//Commented out.
                        > > > > >> //var _yahooDemo =
                        > > > > >>
                        > > >
                        > "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&results=2&output=json
                        > > > > >>
                        > > > > >> var sUrl = "http://ss.ask.com/query?fn=myCallback&sstype=prefix
                        > > > > >> var oDS = new YAHOO.util.ScriptNodeDataSource(sUrl);
                        > > > > >> var oAC = new YAHOO.widget.AutoComplete("myTextbox",
                        > > > > >> "autocompleteContainer", oDS);
                        > > > > >> oAC.queryDelay = .5;
                        > > > > >> // The webservice needs additional parameters
                        > > > > >> oAC.generateRequest = function(sQuery) {
                        > > > > >> return
                        > > > > >> sQuery;
                        > > > > >> };
                        > > > > >>
                        > > > > >> //IT SHOULD POP A MESSAGE ALERT BUT DOESN'T. IT WORKS IF I
                        > CHANGE MY
                        > > > > >> SOURCE TO _YAHOODEMO.
                        > > > > >> oDS.doBeforeParseData = function( oRequest , oFullResponse ,
                        > > > oCallback )
                        > > > > >> {
                        > > > > >> alert("I should see this message");
                        > > > > >> return oFullResponse;
                        > > > > >> };
                        > > > > >>
                        > > > > >> return {
                        > > > > >> oDS: oDS,
                        > > > > >> oAC: oAC
                        > > > > >> };
                        > > > > >> ....
                        > > > > >>
                        > > > > >> function myCallback(oResponse) {
                        > > > > >> //Here's my callback fn. I can get the response here.
                        > > > > >> }
                        > > > > >>
                        > > > > >> Any ideas on this?
                        > > > > >>
                        > > > > >> Regards,
                        > > > > >> kennyth01
                        > > > > >>
                        > > > > >> --- In ydn-javascript@yahoogroups.com, wrote:
                        > > > > >>
                        > > > > >>> It is a little complicated, indeed. There is another
                        > > > alternative, check
                        > > > > >>> method doBeforeParseDa ta in DataSource. It is function
                        > meant to be
                        > > > > >>> overriden, the one that comes with DataSource does nothing
                        > else but
                        > > > > >>>
                        > > > > >> return
                        > > > > >>
                        > > > > >>> one of the argument it receives untouched. You may, however,
                        > > > touch it
                        > > > > >>> anyway you want as long as you return it in more or less the
                        > > > same shape.
                        > > > > >>>
                        > > > > >>> They are documented, both in the user guide for DataSource and
                        > > > in the
                        > > > > >>>
                        > > > > >> API,
                        > > > > >>
                        > > > > >>> check it out. doBeforeParseData is executed before any
                        > > > information is
                        > > > > >>> parsed so
                        > > > > >>>
                        > > > > >> the responseSchema has to reflect the data structure you
                        > > > > >> return
                        > > > > >>
                        > > > > >>> from that function, not the one that function receives in
                        > one if its
                        > > > > >>> arguments. That function is completely synchronous, you won't
                        > > > need to be
                        > > > > >>> concerned about timing.
                        > > > > >>>
                        > > > > >>> Satyam
                        > > > > >>>
                        > > > > >>>
                        > > > > >>> On Mon, 04 May 2009 16:42:54 -0000, "kennyth01" kennyth01@
                        > > > > >>> wrote:
                        > > > > >>>
                        > > > > >>>> Thanks for the pointers satyam. Does this also mean that I
                        > will
                        > > > create
                        > > > > >>>>
                        > > > > >> a
                        > > > > >>
                        > > > > >>>> seperate event to just trigger the Connection Manager's
                        > > > asyncRequest
                        > > > > >>>>
                        > > > > >> and
                        > > > > >>
                        > > > > >>>> make it as a LocalDataSource then instantiating the
                        > > > Autocomplete? Does
                        > > > > >>>> this also mean that the attached event in the autocomplete
                        > will be
                        > > > > >>>> useless?
                        > > > > >>>>
                        > > > > >>>> Regards,
                        > > > > >>>> kennyth01
                        > > > > >>>>
                        > > > > >>>>
                        > > > > >>>> --- In ydn-javascript@yahoogroups.com, satyam@ wrote:
                        > > > > >>>>
                        > > > > >>>>> Then just use Connection Manager's asyncRequest to fetch
                        > the data,
                        > > > > >>>>>
                        > > > > >>>> change
                        > > > > >>>>
                        > > > > >>>>> it to some suitable format and use a LocalDataSource to
                        > read the
                        > > > > >>>>>
                        > > > > >>>> processed
                        > > > > >>>>
                        > > > > >>>>> result.
                        > > > > >>>>>
                        > > > > >>>>> Satyam
                        > > > > >>>>>
                        > > > > >>>>> On Mon, 04 May 2009 13:45:29 -0000,
                        > > > > >>>>>
                        > > > > >> "kennyth01" kennyth01@
                        > > > > >>
                        > > > > >>>>> wrote:
                        > > > > >>>>>
                        > > > > >>>>>> Thanks for the explanation Satyam.
                        > > > > >>>>>> Yup you're right, the structure of the data is totally
                        > wrong. But
                        > > > > >>>>>>
                        > > > > >> is
                        > > > > >>
                        > > > > >>>>> there
                        > > > > >>>>>
                        > > > > >>>>>> any workaround to be able to get the second array? How
                        > about gett
                        > > > > >>>>>>
                        > > > > >> ing
                        > > > > >>
                        > > > > >>>> it
                        > > > > >>>>
                        > > > > >>>>> and
                        > > > > >>>>>
                        > > > > >>>>>> format it in a proper way?
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                        > > > > >>>>>>
                        > > > > >>>>>>> As I said, that is not a proper format for what you mean.
                        > > > Sorry to
                        > > > > >>>>>>>
                        > > > > >>>>>> sound
                        > > > > >>>>>>
                        > > > > >>>>>>> pedantic but the 'semantics' of your message is wrong. The
                        > > > > >>>>>>>
                        > > > > >> structure
                        > > > > >>
                        > > > > >>>> of
                        > > > > >>>>
                        > > > > >>>>>>> your message does not convey the key:data relationship
                        > that you
                        > > > > >>>>>>>
                        > > > > >> mean
                        > > > > >>
                        > > > > >>>> to
                        > > > > >>>>
                        > > > > >>>>>>> express. Both 'fruits' and the array containing the
                        > values are
                        > > > > >>>>>>>
                        > > > > >>>> simple
                        > > > > >>>>
                        > > > > >>>>>>> items in an array, they are siblings, they don't have a
                        > > > key:values
                        > > > > >>>>>>> relationship. That's why it is difficult to represent in the
                        > > > > >>>>>>> responseSchema, because there is no way to express a
                        > > > relationship
                        > > > > >>>>>>>
                        > > > > >>>> that
                        > > > > >>>>
                        > > > > >>>>>> does
                        > > > > >>>>>>
                        > > > > >>>>>>> not
                        > > > > >>>>>>>
                        > > > > >> exist.
                        > > > > >>
                        > > > > >>>>>>> Satyam
                        > > > > >>>>>>>
                        > > > > >>>>>>>
                        > > > > >>>>>>> On Mon, 04 May 2009 13:05:21 -0000, "kennyth01"
                        > > > > >>>>>>> wrote:
                        > > > > >>>>>>>
                        > > > > >>>>>>>> Thanks Satyam! I'll try this one out. But how about if
                        > I'm not
                        > > > > >>>>>>>>
                        > > > > >>>> using
                        > > > > >>>>
                        > > > > >>>>>>>> LocalDataSource? For example, I will use a script node:
                        > > > > >>>>>>>>
                        > > > > >>>>>>>> var oDS = new
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>
                        > > >
                        > YAHOO.util.ScriptNodeDataSource("http://www.pathtofruits.com&callback=myCallback
                        > > > > >>
                        > > > > >>>>>>>> and the URL gives a response of :
                        > > > > >>>>>>>> myCallback(['fruits',['g uava','mango','carrots']])
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>> How will I map this response to only get/display guava,
                        > mango
                        > > > > >>>>>>>>
                        > > > > >> and
                        > > > > >>
                        > > > > >>>>>> carrots
                        > > > > >>>>>>
                        > > > > >>>>>>>> on the list(autocomplete).
                        > > > > >>>>>>>>
                        > > > > >>>>>>>> Any idea on how is it on responseSchema? Thanks!
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>> --- In ydn-javascript@yahoogroups.com, wrote:
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> On Mon, 04 May 2009 09:36:05 -0000, "kennyth01" wrote:
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> Hi
                        > > > > >>>>>>>>>
                        > > > > >> masters,
                        > > > > >>
                        > > > > >>>>>>>>> I have a problem getting results on an array data.
                        > Here's the
                        > > > > >>>>>>>>>
                        > > > > >>>>>> snippet:
                        > > > > >>>>>>
                        > > > > >>>>>>>>> ...
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> var data = ['fruits',['guava','mango','carrots']];
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> var oDS = new YAHOO.util.LocalDataSource(data);
                        > > > > >>>>>>>>> You can change the line above to: var oDS = new
                        > > > > >>>>>>>>> YAHOO.util.LocalDataSource(data[1]); and then forget about
                        > > > > >>>>>>>>>
                        > > > > >>>>>> resultsList.
                        > > > > >>>>>>
                        > > > > >>>>>>>>> However,I think that what you want in that array above
                        > is more
                        > > > > >>>>>>>>>
                        > > > > >>>> like:
                        > > > > >>>>
                        > > > > >>>>>>>>> {'fruits':['guave','mang','carrots']} Otherwise, the
                        > second
                        > > > > >>>>>>>>>
                        > > > > >> item
                        > > > > >>
                        > > > > >>>> in
                        > > > > >>>>
                        > > > > >>>>>> the
                        > > > > >>>>>>
                        > > > > >>>>>>>>> array has no relation whatsoever to the first element
                        > > > > >>>>>>>>> Satyam
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> oDS.responseType =
                        > > > > >>>>>>>>>
                        > > > > >> YAHOO.util.ScriptNodeDataSource.TYPE_JSARRAY;
                        > > > > >>
                        > > > > >>>>>>>>> //I believe my mapping is wrong? Help me map on this
                        > please.
                        > > > > >>>>>>>>> oDS.responseSchema = {
                        > > > > >>>>>>>>> resultsList: ["Fruits"],
                        > > > > >>>>>>>>> fields : ["Label"]
                        > > > > >>>>>>>>> };
                        > > > > >>>>>>>>> oAC = new
                        > > > > >>>>>>>>>
                        > > > > >> YAHOO.widget.AutoComplete("sttop",
                        > > > > >>
                        > > > > >>>> "autocompleteContainer",
                        > > > > >>>>
                        > > > > >>>>>>>>> oDS);
                        > > > > >>>>>>>>> oAC.queryDelay = .5;
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> //How do I format it when I only want to display are
                        > list of
                        > > > > >>>>>>>>>
                        > > > > >>>> fruits?
                        > > > > >>>>
                        > > > > >>>>>>>>> oAC.formatResult = function(oResultItem, sQuery) {
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> return "_" + oResultItem[0] + "_";
                        > > > > >>>>>>>>> };
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> return {
                        > > > > >>>>>>>>> oDS: oDS,
                        > > > > >>>>>>>>> oAC: oAC
                        > > > > >>>>>>>>> };
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> Hoping someone will help me on this. Thanks!
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>> Links:
                        > > > > >>>>>>>>> ------
                        > > > > >>>>>>>>> [1]
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>>
                        > > > > >>
                        > > >
                        > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnZjA2c2E4BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNDI5ODMz
                        > > > > >>
                        > > > > >>>>>>>>> [2]
                        > mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                        > > > > >>>>>>>>>
                        > > > > >>>>> ; > Delivery:
                        > > > > >>>>>
                        > > > > >>>>>>>>> Digest
                        > > > > >>>>>>>>> [3]
                        > > > > >>>>>>>>>
                        > > > > >> mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                        > > > > >>
                        > > > > >>>>>>>>> Delivery Format: Fully
                        > > > > >>>>>>>>> Featured
                        > > > > >>>>>>>>> [4]
                        > > > > >>>>>>>>>
                        > > > > >>>>>>>>>
                        > > > > >>
                        > > >
                        > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJldjg3cXY5BF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTQyOTgzMw--
                        > > > > >>
                        > > > > >>>>>>>>> [5] http://docs.yahoo.com/info/terms/
                        > > > > >>>>>>>>> [6]
                        > > > > >>>>>>>>>
                        > > > > >>>>
                        > > > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                        > > > > >>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>> ------------------------------------
                        > > > > >>>>>>>>
                        > > > > >>>>>>>> Yahoo! Groups Links
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>> ------------------------------------
                        > > > > >>>>>>
                        > > > > >>>>>> Yahoo! Groups Links
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>>>
                        > > > > >>>>
                        > > > > >>>>
                        > > > > >>>> ------------------------------------
                        > > > > >>>>
                        > > > > >>>> Yahoo! Groups Links
                        > > > > >>>>
                        > > > > >>>>
                        > > > > >>>>
                        > > > > >>>>
                        > > > > >>
                        > > > > >>
                        > > > > >> Links:
                        > > > > >> ------
                        > > > > >> [1]
                        > > > > >>
                        > > >
                        > http://groups.yahoo.com/group/ydn-javascript/join;_ylc=X3oDMTJnb21sNGRyBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMjQxNTI1MzUz
                        > > > > >> [2] mailto:ydn-javascript-digest@yahoogroups.com?subject=Email
                        > > > Delivery:
                        > > > > >> Digest
                        > > > > >> [3]
                        > mailto:ydn-javascript-fullfeatured@yahoogroups.com?subject=Change
                        > > > > >> Delivery Format: Fully Featured
                        > > > > >> [4]
                        > > > > >>
                        > > >
                        > http://groups.yahoo.com/group/ydn-javascript;_ylc=X3oDMTJlOThha2poBF9TAzk3NDc2NTkwBGdycElkAzE2ODA4OTA0BGdycHNwSWQDMTcwNTAwNjk0MgRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTI0MTUyNTM1Mw--
                        > > > > >> [5] http://docs.yahoo.com/info/terms/
                        > > > > >> [6]
                        > > > mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe
                        > > > > >>
                        > > > > >>
                        > > > > >
                        > > > > >
                        > > > > >
                        > > > > >
                        > > > > > ------------------------------------
                        > > > > >
                        > > > > > Yahoo! Groups Links
                        > > > > >
                        > > > > >
                        > > > > >
                        > > > > >
                        > > >
                        > ------------------------------------------------------------------------
                        > > > > >
                        > > > > >
                        > > > > > No virus found in this incoming message.
                        > > > > > Checked by AVG - www.avg.com
                        > > > > > Version: 8.5.287 / Virus Database: 270.12.21/2104 - Release Date:
                        > > > 05/08/09 06:34:00
                        > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > > >
                        > > >
                        > > >
                        > ------------------------------------------------------------------------
                        > > >
                        > > >
                        > > > No virus found in this incoming message.
                        > > > Checked by AVG - www.avg.com
                        > > > Version: 8.5.325 / Virus Database: 270.12.23/2106 - Release Date:
                        > 05/09/09 06:54:00
                        > > >
                        > > >
                        > >
                        >
                        >
                        >
                        > ------------------------------------------------------------------------
                        >
                        >
                        > No virus found in this incoming message.
                        > Checked by AVG - www.avg.com
                        > Version: 8.5.325 / Virus Database: 270.12.24/2107 - Release Date: 05/10/09 07:02:00
                        >
                        >
                      Your message has been successfully submitted and would be delivered to recipients shortly.