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

Can DataSource take XML DOM via the constructor?

Expand Messages
  • Stuart Grimshaw
    At the point in our app where I want to draw a table, I already have the XML I want to use in a DOM object. Is there any way to make the DataSource/DataTable
    Message 1 of 3 , Mar 2, 2007
      At the point in our app where I want to draw a table, I already have
      the XML I want to use in a DOM object. Is there any way to make the
      DataSource/DataTable use this?

      I notice in DataSource's constructor when it's trying to work out what
      dataType to use, none of the options are XML.

      I've tried forcing the dataType after the constructor, but that made
      no difference.

      Last DataTable question for today, I promise.
    • jennykhan
      Hi Stuart, As of the current release, local XML data is not support for DataSources. Only XML retrieved via XHR is supported. We ll considering adding this
      Message 2 of 3 , Mar 19, 2007
        Hi Stuart,

        As of the current release, local XML data is not support for
        DataSources. Only XML retrieved via XHR is supported. We'll
        considering adding this feature for a future release, but for now, it
        would need to be achieved through customizations to the DataSource class.

        Thanks,
        Jenny



        --- In ydn-javascript@yahoogroups.com, "Stuart Grimshaw"
        <stuart.grimshaw@...> wrote:
        >
        > At the point in our app where I want to draw a table, I already have
        > the XML I want to use in a DOM object. Is there any way to make the
        > DataSource/DataTable use this?
        >
        > I notice in DataSource's constructor when it's trying to work out what
        > dataType to use, none of the options are XML.
        >
        > I've tried forcing the dataType after the constructor, but that made
        > no difference.
        >
        > Last DataTable question for today, I promise.
        >
      • Stuart Grimshaw
        ... class. That s what I did in the end, I extended DataTable and overrode initTable & paginateRows. The grid is already created in the page using client side
        Message 3 of 3 , Mar 29, 2007
          --- In ydn-javascript@yahoogroups.com, "jennykhan" <jennyhan@...> wrote:
          >
          > Hi Stuart,
          >
          > As of the current release, local XML data is not support for
          > DataSources. Only XML retrieved via XHR is supported. We'll
          > considering adding this feature for a future release, but for now, it
          > would need to be achieved through customizations to the DataSource
          class.

          That's what I did in the end, I extended DataTable and overrode
          initTable & paginateRows.

          The grid is already created in the page using client side XSLT
          (Sarissa) and then populate the various fields in initTable from the
          existing markup:

          Web.Widgets.DataTable.prototype._initTable = function()
          {

          // Set up the table.
          var tables = this._elContainer.getElementsByTagName("table");
          this._elTable = tables[0];

          var heads = this._elTable.getElementsByTagName("thead");
          this._elHead = heads[0];

          var bodies = this._elTable.getElementsByTagName("tbody");
          this._elBody = bodies[0];

          // Set up scrolling
          if(this.scrollable) {
          //TODO: conf height

          YAHOO.util.Dom.addClass(this._elContainer,YAHOO.widget.DataTable.CLASS_SCROLLABLE);

          YAHOO.util.Dom.addClass(this._elBody,YAHOO.widget.DataTable.CLASS_SCROLLABLE);

          YAHOO.util.Dom.addClass(this._elBody,YAHOO.widget.DataTable.CLASS_BODY);
          }
          }

          Works pretty well so far, but if you can see any glaring errors in
          this approach ...
        Your message has been successfully submitted and would be delivered to recipients shortly.