468,526 Members | 2,097 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,526 developers. It's quick & easy.

Show/Hide Multiple Rows in Table

Hi, I am working on a table with asp and I would like to add a feature to show/hide all rows within the a section of the table. This code show/hide only one row at a time, so I need help with show/hide all related rows within the section.
Thanks.

Expand|Select|Wrap|Line Numbers
  1. function sh_RowShowHide(sh_RowID) {
  2. var currRow = document.getElementById(sh_RowID);
  3. if (currRow.style.display=="none") {
  4. currRow.style.display="";
  5. document.getElementById(sh_RowID+"img").src = sh_HideImg;
  6. } else {
  7. currRow.style.display="none";
  8. document.getElementById(sh_RowID+"img").src = sh_ShowImg;
  9. }
  10. }

The recordset is determine by a loop within a loop.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. FilterParam = Recordset1.Fields.Item("request_id").Value
  3. Recordset3.Filter = "related_request = '" & FilterParam & "'" 
  4. Do while ( not Recordset3.EOF)
  5. %>
Nov 23 '11 #1
3 2279
Rabbit
12,513 Expert Mod 8TB
How do you know they're related? Sample data would go a long way.
Nov 23 '11 #2
Hi, Recordset1 returns all of the request ids to the web page table
then the user should be able to click on an image to expand the related ids that are assigned with the target group name.

Expand|Select|Wrap|Line Numbers
  1. <img
  2. src="/POW/global/images/arrow_out_new.gif" width="20" height="11" border="0"   id="<%=Recordset1.Fields.Item("request_id")%>img"
  3. style="clear:both;"
  4. onclick="toggle('name')" />
  5.  
  6. function toggle(name) {
  7. tr=document.getElementsByTagName('tr')
  8. for (i=0;i<tr.length;i++){
  9. if (tr[i].getAttribute(name)){
  10. if (tr[i].style.display=='none'){tr[i].style.display = '';}
  11. else {tr[i].style.display = 'none';}
  12. }
  13. }
  14.    }
Nov 24 '11 #3
Rabbit
12,513 Expert Mod 8TB
Loop through and check each group name. Something along the lines of
Expand|Select|Wrap|Line Numbers
  1. tempVar = clicked on group name
  2. for each row
  3.    if row's group name = tempVar then
  4.       toggle visibility
  5.    end if
  6. next row
Nov 24 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Harry | last post: by
1 post views Thread by Rick Measham | last post: by
9 posts views Thread by Don Grover | last post: by
2 posts views Thread by jeet_sen | last post: by
1 post views Thread by shankwheat | last post: by
5 posts views Thread by Dautkhanov | last post: by
2 posts views Thread by vcuankitdotnet | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.