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

Re: [ydn-javascript] DataTable Control DataSource = HTML Table

Expand Messages
  • Satyam
    Did you actually append the table to the page via appendChild? The Datasouce won t be able to find it if not accessible within the document. Otherwise you
    Message 1 of 4 , Oct 31, 2008
    • 0 Attachment
      Did you actually append the table to the page via appendChild? The
      Datasouce won't be able to find it if not accessible within the
      document. Otherwise you could have passed the DataSource the variable
      tempTable. What I wonder is why do you bother to go through an HTML
      table if the DataSource can read from an array, which is easier and much
      faster.

      Satyam


      iam_focusedman wrote:
      > I am running some tests on the DataTable control to see if it would
      > work for my application.
      >
      > I am creating a table using:
      >
      > var tempTable = document.createElement("table");
      > tempTable.setAttribute("id", "temp");
      >
      > and I then fill the table using the proper insertCell() and
      > insertRow() calls. Which produces a table such as:
      >
      > <table id = "test">
      > <tbody>
      > <tr><td>ABC</td><td>NAME</td></tr>
      > <tr><td>123</td><td>BILL</td></tr>
      > <tr><td>456</td><td>JOHN</td></tr>
      > </tbody>
      > </table>
      >
      > I am then using:
      >
      > var myDiv = new YAHOO.util.Dom.get("xml");
      > var myDataSource = new
      > YAHOO.util.LocalDataSource(YAHOO.util.Dom.get("temp"));
      > myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
      > myDataSource.responseSchema = {
      > fields: ["123", "NAME"]
      > };
      >
      > var myColumnDefs = [
      > {key:"123", sortable:true},
      > {key:"NAME"}
      > ];
      >
      > var myDataTable = new YAHOO.widget.DataTable("xml", myColumnDefs,
      > myDataSource);
      >
      >
      > Which creates the DataTable control on the html page in the xml div
      > but it does not fill with data. I get the column headings ABC and
      > NAME with a "Loading..." message. If I click on the ABC column
      > heading I get "No Records Found." However, if I hard code the same
      > table directly into the web page the DataTable displays as it should.
      > Any ideas?
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.175 / Virus Database: 270.8.5/1757 - Release Date: 30/10/2008 14:35
      >
      >
    • iam_focusedman
      Ah ha - that did it! I was using a table because I could not get the xml data source working properly. I suspect the appendChild will fix that also. Thanks
      Message 2 of 4 , Nov 1, 2008
      • 0 Attachment
        Ah ha - that did it!

        I was using a table because I could not get the xml data source
        working properly. I suspect the appendChild will fix that also.
        Thanks for the help!
      • iam_focusedman
        Ok, so I changed my datasource to array, and the table is reading the array but the data is not going into the proper colunmns. Instead of getting: Name |
        Message 3 of 4 , Nov 13, 2008
        • 0 Attachment
          Ok, so I changed my datasource to array, and the table is reading the
          array but the data is not going into the proper colunmns.

          Instead of getting:

          Name | Address
          Bob 123 St.

          I am getting:

          Name | Address
          Bob, 123 St. Bob, 123 St.

          If I hard code the array contents like this:

          address[0] = ["Bob","123 St"];

          the data falls into the columns properly.

          I want the array to be created using a for loop like this:

          for(var i = 0; i < data.length; i++){
          address[i] = data[i].innerHTML;
          }

          Any suggestions?
        Your message has been successfully submitted and would be delivered to recipients shortly.