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

Modal with a Tab

Expand Messages
  • gradescript
    Hello i am currently creating a modal window which has a tabview init, but what i want to happen is once the dataSrc on the first tab is loaded, THEN show the
    Message 1 of 1 , Jul 3, 2007
    • 0 Attachment
      Hello i am currently creating a modal window which has a tabview init,
      but what i want to happen is once the dataSrc on the first tab is
      loaded, THEN show the modal window. Because it is showing earlier then
      positioning of the modal window isnt centered because the content is
      smaller then when it loads. My current code is


      YAHOO.namespace('mostyle.panel.members');

      YAHOO.mostyle.panel.members = {

      members: false,

      load: function() {

      obj = this;

      Dom.get('config-body').innerHTML = "";

      // Instantiate the Dialog
      this.members = YAHOO.mostyle.modal(700);

      //Config
      this.members.setHeader('Members Administration');
      this.members.setFooter('<a href="#save">Save</a> <a href="#close"
      id="members_hide">Close</a>');

      // Render the Dialog
      obj.members.render(document.body);

      // Create tab handle
      var tab = new YAHOO.widget.TabView({id: 'tabs'});

      // Add tabs
      tab.addTab(new YAHOO.widget.Tab({
      label: 'Add', dataSrc: '/application/views/web/test/1.php',
      active: true,
      }));

      tab.addTab(new YAHOO.widget.Tab({
      label: 'Edit', dataSrc: '/application/views/web/test/2.php',
      cacheData: true /* only load once */
      }));

      // Apppend to document
      YAHOO.util.Event.onContentReady('config-body', function() {
      tab.appendTo(this);
      });

      YAHOO.util.Event.onAvailable('tabs', function() {
      obj.members.show();
      });

      // Add esc listener
      var esc = new YAHOO.util.KeyListener(document,
      { keys:27 },
      { fn:this.members.hide,
      scope:this.members, correctScope:true }
      );
      esc.enable();

      // Add event listeners
      YAHOO.util.Event.addListener("members_show", "click",
      this.members.show, this.members, true);
      YAHOO.util.Event.addListener("members_hide", "click",
      this.members.hide, this.members, true);

      },

      show: function() {
      if ( this.members == false )
      YAHOO.mostyle.panel.members.load();
      else
      this.members.show();
      }

      };

      //YAHOO.util.Event.addListener(window, "load",
      YAHOO.mostyle.panel.members.load);
    Your message has been successfully submitted and would be delivered to recipients shortly.