kanguyen
asked on
How to expand and collapse multiple rows in table using Java script
Hi Friends,
How can you collapse and expand multiple rows dynamically. Variables should not be hard coded.
Can some one explain me with example?
I have a table in following way.
+Title 1
+Title 2
+Title 3
+Title 4
Now on clicking Title 1 i should see the following
- Title 1
--Sub Row1
--Sub Row 2
now on clicking Title 2 i should see the following
- Title 2
--Sub Row 1
--Sub Row 2
--Sub Row 3
--Sub Row 4
now on clicking Title 3 i should see the following
- Title 3
--Sub Row 1
--Sub Row 2
now on clicking Title 4 i should see the following
- Title 4
--Sub Row 1
--Sub Row 2
How can you collapse and expand multiple rows dynamically. Variables should not be hard coded.
Can some one explain me with example?
I have a table in following way.
+Title 1
+Title 2
+Title 3
+Title 4
Now on clicking Title 1 i should see the following
- Title 1
--Sub Row1
--Sub Row 2
now on clicking Title 2 i should see the following
- Title 2
--Sub Row 1
--Sub Row 2
--Sub Row 3
--Sub Row 4
now on clicking Title 3 i should see the following
- Title 3
--Sub Row 1
--Sub Row 2
now on clicking Title 4 i should see the following
- Title 4
--Sub Row 1
--Sub Row 2
contactkarthi:
That is to dynamically hide or show existing predefined rows.
It sounds like he wants to dynamically create the rows on a click event:
2 Flavers (DOM and innerHTML)
http://www.oreillynet.com/pub/a/javascript/2003/05/06/dannygoodman.html
That is to dynamically hide or show existing predefined rows.
It sounds like he wants to dynamically create the rows on a click event:
2 Flavers (DOM and innerHTML)
http://www.oreillynet.com/pub/a/javascript/2003/05/06/dannygoodman.html
And this one is a bit easier but only using DOM
http://www.howtocreate.co.uk/tutorials/javascript/domtables
http://www.howtocreate.co.uk/tutorials/javascript/domtables
ASKER
sorry guys, that's is not what I look for.
from the example I had given above,
i.e the data already populated into the table with sub rows collapse where row ids are the same, now what I'd like is when I click on the plus sign the sub rows will expand under that category eg Title1 and the plus sign will become minus sign.
can the experts give example code please.
Thanks in advance.
from the example I had given above,
i.e the data already populated into the table with sub rows collapse where row ids are the same, now what I'd like is when I click on the plus sign the sub rows will expand under that category eg Title1 and the plus sign will become minus sign.
can the experts give example code please.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
https://www.experts-exchange.com/questions/21628290/Expand-Collapse-table-rows.html