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

Re: YUI approach

Expand Messages
  • Ted Husted
    ... The key is to use a power constructor that can create and configure (or augment ) the object on demand. When we do construct the object, we can assign
    Message 1 of 5 , Apr 28, 2007
    • 0 Attachment
      > Activating a dataTable includes scripting the table and assigning it
      > a layer id.

      The key is to use a "power constructor" that can create and configure
      (or "augment") the object on demand. When we do construct the object,
      we can assign it to a known variable. When an event like a tab switch
      occurs, we can look to see if the variable is defined. If so, we just
      use it. If not, we call the power constructor.

      YAHOO.example.init = function() {
      var tabView = new YAHOO.widget.TabView('demo');

      tabView.on('contentReady', function() {
      var handleTab1 = function(e) {
      if (!YAHOO.example.oBasic)l
      alert('Ready to fetch the DataTable?');
      YAHOO.example.oBasic = YAHOO.example.InitBasic();
      }
      };
      this.getTab(1).addListener('click', handleTab1);

      var handleTab2 = function(e) {
      if (!YAHOO.example.oXML) {
      alert('Ready to fetch the DataTable by XHR/XML?');
      YAHOO.example.oXML = YAHOO.example.InitXML(); }
      };
      this.getTab(2).addListener('click', handleTab2);
      });
      };

      Here, we combine the DataTable and TabView examples to demonstrate
      changing tabs and instantiating a DataTable on demand. One tab uses
      static data, another uses XHR/XML. The latter doesn't finish loading
      the data because of the single-domain limitation on XHR calls. But, if
      a server-side page were set up, I believe it would complete normally.

      The working code is posted here:

      *
      http://www.geocities.com/planetyazaar/examples/datatable/basic-tabview.html

      HTH, Ted.
    Your message has been successfully submitted and would be delivered to recipients shortly.