Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Hiding Table Rows

From: "AliR" <AliR@------.------>
To: NULL
Date: 4/21/2006 11:14:00 AM

We got away from the Multiple table scheme, because we had a hard time
lining up the columns of the multiple tables.  So we simply use a single
table, with parent child tags, and when the user collapse/expand a parent
item, we loop through the table and hide/show the child items.

Here is the code.  What we do is pass the table id and row number to
collapse/expand to the toggle function.

function ToggleChildren(TableID,RowNum,bExpand)
{
   var MyTable = document.getElementById(TableID);

   ParentRow = MyTable.rows[RowNum];

   var ParentID = ParentRow.getAttribute("id");

   //Get selected row
   for (var i = RowNum+1; i < MyTable.rows.length;i++)
   {
      MyRow = MyTable.rows[i];
      var PID = MyRow.getAttribute("pid");
      if (PID == ParentID)
      {
         if (bExpand == 'true')
         {
            MyRow.style.display = "";
         }
         else
         {
            MyRow.style.display = "none";
         }
         var AlreadyExpanded = MyRow.getAttribute("expanded");
         if (bExpand == 'true' && AlreadyExpanded == 'true')
         {
            ToggleChildren(TableID,i,bExpand);
         }
         else if (bExpand == 'false')
         {
            ToggleChildren(TableID,i,bExpand);
         }
      }
   }
}

function Toggle(TableID,RowNum)
{
   //Get only one table for now
   var MyTable = document.getElementById(TableID);

   ParentRow = MyTable.rows[RowNum];

   var Expanded = ParentRow.getAttribute("expanded");

   if (Expanded == 'true')
   {
      Expanded = 'false';
   }
   else
   {
      Expanded = 'true';
   }

   //Set expanded flag to accordingly
   ParentRow.setAttribute("expanded",Expanded);

   ToggleChildren(TableID,RowNum,Expanded);

}


AliR.

"Scamjunk" <brahadambal@g...> wrote in message
news:1144819340.935210.105800@g......
> Hi,
>
> I am looking for a solution to a problem where I need to have a table
> format, and allow expansion or collapsing by the user. Since you
> already seem to have a solution ready, could you give guidelines to
> proceed? I have only been able to get everything into a single table.
> How to do it using multiple tables? how to get the multiple tables to
> synchronize? Please help.
>
> Thanks and warm regards,
> Scam.
>




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent