By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

Show/Hide Multiple Rows in Table

P: 2
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
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,430
How do you know they're related? Sample data would go a long way.
Nov 23 '11 #2

P: 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
Expert Mod 10K+
P: 12,430
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.