Problem with dynamic collapsible table

Hi, I am trying to build a page that has a table inside a collapsible div. The table is dynamic, in that it is populated from a MySQL database.

Now, the problem I have is that when I expand the table, I only get the very first row from the database. I know that they all need a unique ID so I am using the record ID from the db to dynamically assign each row a unique number, but it still does not work, I just get the first row. (They are all pulled, the div just does not show them all. )

So I played around a bit and moved the code inside the repeat region for the table, this was halfway there, except now I get a “show” link for EVERY row of the table and I have to click each one individually to show it’s corresponding data. So I am at a loss. I am trying to make it so clicking one link at the top reveals the entire table, but it’s just not working, so any help would be greatly appreciated.

Here is what I am using so far…

Javascript that handles show/hide part

 <script language="javascript">
  function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = '';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }
</script>

The link Im using to show/hide the table

<a href="javascript:;" onmousedown="toggleDiv('t<?php echo $row_info['memID'] ?>);">Show/Hide</a>

DIV

<div id="t<?php echo $row_info['memID'] ?>" style="display:none">
[table here]
</div>

Any help would be greatly appreciated… thanks in advance!

You forgot to add single quote (’) (in red) inside the toggle Div function :

Show/Hide

I hope it should work now. It it doesn’t, then let me know.

Sponsor our Newsletter | Privacy Policy | Terms of Service