Jump to content
  • Advertisement
Sign in to follow this  
Chozo

[web] Hiding table rows

This topic is 4950 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got some HTML here:
<div style="visibility:hidden;" id="60004">
<tr>
<td align="center" valign="middle"><input type="checkbox" name="select_report" value="60005">
<td align="left">    expandWebex total sessions by domain</td>
<td align="left">-1</td>
<td align="left">-1</td>

<td align="left">-1</td>
<td align="left">-1</td>
</tr>
That I'm trying to use to hide some table rows. Basically what I have is a table of report information that I need to behave sort of like a tree view. The problem is that the div's aren't hiding the table rows (I can't even get to the point of working on the javascript because of this). I'm not sure if this is even possible, but I can't think of another solution. The data has to be in a table and it has to behave like a tree view. Did I do something wrong in the style of the div? Is there a better solution I could look at that would maintain the format of the tables? Thanks in advance for any advice or help.

Share this post


Link to post
Share on other sites
Advertisement
Putting
inside a tbody, thead or table, is almost certainly the Wrong thing to do.

You can set a table row to display:none by giving it an ID, and hide it this way. But it's not guaranteed to work properly, because it will almost certainly manage to lose some of its "magic" of being-a-table-row - in Mozilla certainly.

As far as I can tell, from my initial experiments, some other technique is required to make this work.

Setting a table-row to display:none is fine, but setting it to display:block is wrong and causes the table to become rather broken.

Maybe there is a correct way of doing this. Perhaps there is a DOM technique to manipulate table rows properly.

Mark

Share this post


Link to post
Share on other sites
Why do you have to use the DIV at all? Can't you just do something like this:


<table>
<tr id="60004" style="visibility:hidden;">
<td>This is hidden</td>
</tr>
<tr id="60005">
<td>This is not hidden</td>
</tr>
</table>


That works for me in Firefox.

Tony

Share this post


Link to post
Share on other sites
Because the div's nest. It's supposed to act like a tree view. So if you expand one, then it's children, then collapse the parent, the children stay open but are hidden. That make sense? I've switched to using display:none in the tr, but it has the disadvantage of losing state information in order to hide children. Which means it behaves kind of like a tree view, but without the nesting effect.

I'd much rather use the div idea, but I guess that can't be done. Thanks for the help.

Share this post


Link to post
Share on other sites
Quote:
Setting a table-row to display:none is fine, but setting it to display:block is wrong and causes the table to become rather broken.

You should probably set it to "table-row" to return it to normal. I'm not sure what IE would do though. The best bet is probably to set the display to nothing (display=""), which lets the browser revert back to whatever its default is.

[Edited by - konForce on April 5, 2005 10:43:44 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by konForce
Quote:
Setting a table-row to display:none is fine, but setting it to display:block is wrong and causes the table to become rather broken.

You should probably set it to "table-row" to return it to normal. I'm not sure what IE would do though. The best bet is probably to set the display to nothing (display=""), which lets the browser revert back to whatever its default is.
You need to use "table-row" for standards browsers and "block" for IE (took me a looooong time searching through mozilla's bugzilla to find that :P)

Share this post


Link to post
Share on other sites
Also, keep every child 'list' as a new table.

However i would be using an UL for this, as a tree-view IS a UL, and it makes sense to use it (the code would become slightly easier)

Share this post


Link to post
Share on other sites
If you want to show a tree-type object, don't use tables. Tables are for tabular data.

Not only is it going to be more effort, but it's also not the Right Way.

Use ULs and LIs and style them correctly - it'll be much easier really.

Mark

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!