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

Re: [ydn-javascript] changing a local datasource to a remote datasource

Expand Messages
  • Satyam
    The relevant properties of DataSource to do what you want are: liveData: the first argument to DataSource constructor is stored in this property. If you want
    Message 1 of 2 , Aug 26, 2008
      The relevant properties of DataSource to do what you want are:

      liveData: the first argument to DataSource constructor is stored in
      this property. If you want to change the type of source, you should
      change this. In your case you would store the base URL for the remote
      data source, meaning the URL up to and including the question mark.

      dataType: This property takes (more or less) the same constants as
      responseType. When you create a DataSource instance, it guesses from
      the nature of the first argument what the data type is. Since you would
      be setting the liveData property directly, you are bypassing the
      dataType guessing so you have to tell it explicitly. You have to tell
      it is of TYPE_XHR
      <http://developer.yahoo.com/yui/docs/YAHOO.util.DataSource.html#property_TYPE_XHR>,
      meaning, instead of a local source, use XHR.

      If the format read from the remote source is the same as you would get
      locally, there is no need to change the responseType or responseSchema,
      otherwise you would need to change those as you would do for a normal
      first-time request.

      When you have all these set, you have to call DataSource sendRequest.
      In: http://developer.yahoo.com/yui/datatable/#datasource, see the
      section titled "Getting More Data".

      Satyam


      Martin Tschofen wrote:
      > I've got a datatable that was initially populated from a local JSON
      > datasource. User's can filter the datatable (based on the local
      > datasource). Now suddenly I need to update the content of the
      > datasource and pull more info back from the server.
      >
      > Rather than replace the entire datatable and start from scratch, is
      > there a way I can change the existing datasource to go back to the
      > server for more info?
      >
      > I looked a little at the initalRequest. Would it be possible to setup
      > the datasource as remote initally, but in the initialrequest load the
      > local json data instead?
      >
      > Is there a better way?
      >
      > Any idea would be appreciated...martin
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.138 / Virus Database: 270.6.7/1632 - Release Date: 25/08/2008 7:05
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.