This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes on clicking all hidden rows of table are displayed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "on clicking all hidden rows of table are displayed" Watch "on clicking all hidden rows of table are displayed" New topic
Author

on clicking all hidden rows of table are displayed

rammie singh
Ranch Hand

Joined: Mar 26, 2009
Posts: 116
Hi everybody

I want to have an html page where in if i click on say "+", the "+" becomes "-" and all the hidden rows are dispalye and if i click on "-" the rows are hidden back. how can we do that??
Can anybody please help me.

Thanks and Regards
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 823
AJAX can do that for you. Give your table an ID and in a javascript grab the table object and loop through the children (i.e. rows) and make them visible or hidden as you go through them. If you have more specific requirements (i.e. start at certain row clicked on) you might want to check out (google) rowIndex. I'm sure you'll get other responses in here that are more efficient but that's how I would do it if I had to right now. Hope it helps.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Ajax really isn't necessary. It's really just a matter of using the display CSS property appropriately.

Ajax would only be necessary if one wishes to delay the fetching of the hidden data until it is required. In that case, Ajax is indispensable.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on clicking all hidden rows of table are displayed