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

Re: [ydn-javascript] Datatable with XHRDataSource POST

Expand Messages
  • Satyam
    You don t need to call sendRequest, the DataTable will do it for you with the url-arguments you provide in the initialRequest configuration attribute. To make
    Message 1 of 2 , Jun 26, 2009
    • 0 Attachment
      You don't need to call sendRequest, the DataTable will do it for you
      with the url-arguments you provide in the initialRequest configuration
      attribute. To make it a POST request, set commMethodPost to true in the
      DataSource. Also, when providing the server URL to the DataSource, put
      a trailing query mark ? at the end of the base URL, otherwise there
      won't be any. It is not important if you are sending your request as a
      POST, but it won't hurt if you put it and if in the future for testing
      or whatever, you decide to try a GET, you are safe. Also, if you don't
      put the 'var', your DataSource will be created in the global namespace,
      which is not a good idea.

      var dataTable = new YAHOO.widget.DataTable("id", columnDefs, dataSource, {
      initialRequest"query=stuff"
      }
      );


      Satyam


      hansamurai escribió:
      > I'm trying to populate a datatable by contacting a data source via POST. I'm trying to use XHRDataSource but I'm not sure how to do it correctly. This is what I have so far:
      >
      > dataSource = new YAHOO.util.XHRDataSource("/my-url");
      > dataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
      > dataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
      > dataSource.responseSchema =
      > {
      > resultNode: "Node",
      > fields: ["field"]
      > };
      > var dataTable = new YAHOO.widget.DataTable("id", columnDefs, dataSource);
      > dataSource.sendRequest("query=stuff");
      >
      > This kicks off two requests to the server, the first from the data table instantiation and there are no parameters on this. I'd really like to include the POST parameters here.
      >
      > The second request from sendRequest() works but it's not tied back to the data table so the data table just shows "Data Error."
      >
      > Any help would be great.
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 8.5.339 / Virus Database: 270.12.92/2203 - Release Date: 06/26/09 05:53:00
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.