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

Datasource 2.6.0

Expand Messages
  • Bernard Gunawan
    Dear All, Need your help. I ve encountered problem on having 2 localdatasource at the same time for autocomplete widget. If i had only one it worked perfectly,
    Message 1 of 1 , Oct 10, 2008
      Dear All,

      Need your help.

      I've encountered problem on having 2 localdatasource at the same time for autocomplete widget.
      If i had only one it worked perfectly, but I really need 2 datasource for 3 autocomplete widget.
      When I remove block comments on second localdatasource it will made my web page blank.


      on html file
      <script type="text/javascript" src="first.js"></script>
      <script type="text/javascript" src="second.js"></script>

      I put first array on first.js as following
      var namaair = [
          {nama: "Amber Air", iata: "0A"},
          {nama: "Darwin Airlines", iata: "0D"},
          {nama: "Amadeus System One", iata: "1A"},
          {nama: "Abacus International", iata: "1B"},
      ];

      second array on second.js as following
      var namakota = [
          {city: "Anaa", iata: "AAA"},
          {city: "Arrabury", iata: "AAB"},
          {city: "Annaba", iata: "AAE"},
          {city: "Apalachicola", iata: "AAF"},
          {city: "Arapoti", iata: "AAG"},
      ];

      source code as following
          YAHOO.Bernard.oDS = new YAHOO.util.LocalDataSource(namakota);
          YAHOO.Bernard.oDS.responseSchema = {fields : ["city", "iata"]};

          YAHOO.Bernard.oACorg = new YAHOO.widget.AutoComplete("cityorgAC","orgcontainer", YAHOO.Bernard.oDS);
          YAHOO.Bernard.oACorg.resultTypeList = false;
          YAHOO.Bernard.oACorg.forceSelection = true;
          YAHOO.Bernard.oACorg.formatResult = function(oResultData, sQuery, sResultMatch) {
              return (sResultMatch + " (" +oResultData.iata+ ")");
          };   

          YAHOO.Bernard.oACdest = new YAHOO.widget.AutoComplete("citydestAC","destcontainer", YAHOO.Bernard.oDS);
          YAHOO.Bernard.oACdest.resultTypeList = false;
          YAHOO.Bernard.oACdest.forceSelection = true;
          YAHOO.Bernard.oACdest.formatResult = function(oResultData1, sQuery1, sResultMatch1) {
              return (sResultMatch1 + " (" +oResultData1.iata+ ")");
          };   
      /*
          YAHOO.Bernard.airoDS = new YAHOO.util.LocalDataSource(namaair);
          YAHOO.Bernard.airoDS.responseSchema = {fields : ["nama", "iata"]};

          YAHOO.Bernard.oACair = new YAHOO.widget.AutoComplete("airAC","aircontainer", YAHOO.Bernard.airoDS);
          YAHOO.Bernard.oACair.resultTypeList = false;
          YAHOO.Bernard.oACair.forceSelection = true;
          YAHOO.Bernard.oACair.formatResult = function(oResultData2, sQuery2, sResultMatch2) {
              return (sResultMatch2 + " (" +oResultData2.iata+ ")");
          };    */

      Kindly advise if I did something wrong.

      Thanks in advance.

      Regards,
      Bernard.
    Your message has been successfully submitted and would be delivered to recipients shortly.