Page 1 of 1

showing/hiding columns in a table

Posted: Tue May 02, 2006 9:47 am
by shadow2026
Hello,

I was wondering if anyone could help me with hiding/showing a column of data in a table. It should remain hidden until the user inputs a password into a textbox and clicks a button, then the column will show itself. Anyone have any ideas of how to get started doing this? I'm not sure how to hide/show cells without php, let alone with it. Any help or advice would be awesome, thank you.

Shadow

Posted: Tue May 02, 2006 9:49 am
by neophyte
I've not done that myself. If youre looking to do it with out reloading the page I'd look at Javascript for a solution.

Posted: Tue May 02, 2006 9:54 am
by Chris Corbyn
Ohhh... that's actually pretty tricky to do with JavaScript because a column is actually the cell at position X across N rows so you need to use some looping to collapse it down. It may be easier to "fake" the column by floating a separate table next to the original one and then literally hiding the whole table.

Style Properties you want to look into playing with are: display, visibility, borderCollapse.

Posted: Tue May 02, 2006 10:19 am
by shadow2026
I was thinking of doing just that, creating a whole new table and hiding the whole thing. I think I may try it that way, it seems like the easiest thing to do. Thank you, and thanks for the style properties :p

Posted: Tue May 02, 2006 11:18 am
by Burrito
the way I've done it in the past is to create a table cell and put a whole new table nested within that particular cell.

if that's the only cell in the row, you and block display or hide just the row and it will encompass the entire table...