showing/hiding columns in a table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shadow2026
Forum Newbie
Posts: 2
Joined: Tue May 02, 2006 9:39 am

showing/hiding columns in a table

Post 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
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
shadow2026
Forum Newbie
Posts: 2
Joined: Tue May 02, 2006 9:39 am

Post 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
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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...
Post Reply