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

Re: DataTable + TabView ... 2nd tab, datatable not doing auto width

Expand Messages
  • bretlevy
    There are times when you might actually *want* to delay the loading/drawing of a table until a tab is clicked. For example, I have a page that splits up
    Message 1 of 3 , Jul 30, 2008
    • 0 Attachment
      There are times when you might actually *want* to delay the
      loading/drawing of a table until a tab is clicked. For example, I have
      a page that splits up "jobs" into 3 tabs; active, pending and future
      (where pending is within 30 days, for example). If the user doesn't go
      to one of the other tabs, then there is really no reason to fetch what
      might be a very long list.

      You trap the tab clicks like this:

      myTabs = new YAHOO.widget.TabView("htmltabscontent");
      myTabs.addListener ('activeTabChange', function(e){
      showTab(myTabs.getTabIndex(e.newValue));
      });

      Then in the showTab() function I check to see if I've already built the
      table or not. If not, I instantiate it and fetch the data. There is a
      slight delay as the xhr process completes, but it still flows nicely (I
      actually code the page with a "spinner" graphic that displays until the
      table is ready to replace the contents of the target div.

      ~~bret


      --- In ydn-javascript@yahoogroups.com, "slapyo" <slapyo@...> wrote:
      >
      > i have a tabview with a datatable on each. on load i populate each
      > tab with a datatable. the datatable in the first tab is fine and the
      > column widths are perfect. but on the 2nd tab the widths of the table
      > are not, they are extremely small and i'm not sure why. i do nothing
      > in regards to setting the column widths.
      >
      > do i need to render the table when the tab is clicked so it's
      > "visible" and the column widths are adjusted properly? if so how do i
      > attach to a tab click.
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.