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

Re: Autocomplete not working

Expand Messages
  • jennykhan
    Hi anandshankar_5, Your code kind of falls apart here: var myColumnDefs = [ // colm defs myDataSource = new YAHOO.util.DataSource( // data source myDataTable =
    Message 1 of 7 , Oct 10, 2008
    • 0 Attachment
      Hi anandshankar_5,

      Your code kind of falls apart here:

      var myColumnDefs = [
      // colm defs

      myDataSource = new YAHOO.util.DataSource(
      // data source
      myDataTable = new YAHOO.widget.DataTable("nested",
      myColumnDefs, myDataSource);



      I'd start with cleaning this up and take it from there.

      Regards,
      Jenny




      --- In ydn-javascript@yahoogroups.com, "anandshankar_5"
      <anandshankar_5@...> wrote:
      >
      > Hi all,
      > I am trying to use the autocomplete widget on a table which picks
      up
      > data from a local array. I am able to see my datatable(again
      > constructed using yui datatable) .here is the code, can somebody
      find
      > it out why is not it working.
      >
      > I have included the required css and script files.
      >
      > <!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -
      ->
      >
      > <style type="text/css">
      > #autocomplete {
      > height: 25px;
      > }
      > #dt_input,{
      > position: static;
      > width: 300px;
      > }
      > #dt_ac_container {
      > display: none;
      > }
      > </style>
      >
      > <div id="autocomplete">
      > <label for="dt_input">Search Term: </label><input id="dt_input"
      > type="text" value="gen">
      > <div id="dt_ac_container"></div>
      > </div>
      >
      >
      > <div id="nested"></div>
      > <script type="text/javascript">
      > (function() {
      >
      > var queryString = '&results=2&output=json'; //what should
      the
      > output type be ?
      >
      > var myDataSource = null;
      > var myDataTable = null;
      >
      > var getTerms = function(query) {
      > myDataSource.sendRequest('datatable=yes&query=' + query +
      > queryString,
      > myDataTable.onDataReturnInitializeTable, myDataTable);
      > };
      > YAHOO.util.Event.onDOMReady(function(){
      > var oACDS = new YAHOO.widget.DS_JSFunction(getTerms);
      > oACDS.queryMatchContains = true;
      > var oAutoComp = new
      > YAHOO.widget.AutoComplete("dt_input","dt_ac_container", oACDS);
      > oAutoComp.minQueryLength = 0;
      > oAutoComp.useShadow = true;
      >
      >
      > var myColumnDefs = [
      > // colm defs
      >
      > myDataSource = new YAHOO.util.DataSource(
      > // data source
      > myDataTable = new YAHOO.widget.DataTable("nested",
      > myColumnDefs, myDataSource);
      > });
      >
      >
      > })();
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.