Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Accordian Table

Posted on 2011-03-16
3
Medium Priority
?
385 Views
Last Modified: 2012-05-11
Can someon provide a code example that will alow me to have a bunch of rows.  When the row is clicked more rows with detail will how up underneath?

i.e.

row
   detail row
row
row
row

detail row(s) will show up under row when row is clicked.
0
Comment
Question by:kyleroi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
JF0 earned 2000 total points
ID: 35150439
This should give you an idea.

<html>
<head>
<title></title>
<style>
.togBut {height:15px;width:15px;border: solid 1px #FFFFFF;}
.divAdd {border:solid 1px red;background-color:#e6e6fa;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script>
<script>
	$(document).ready(function() {
		$('.divAdd').hide();
	
		$('.togBut').click(function(){
		
			$('.divAdd', $(this).parent().next()).slideToggle('normal');
		
		});
			
		$('.togBut').toggle(
			function(){
				$(this).children(":first").attr("src","minus.jpg");
				},
			function(){
				$(this).children(":first").attr("src","plus.jpg");
				}
		);
		
	});
</script>
</head>
<body>

<p/>

<table border='1'>
	<tr>
		<td>
			<div class='togBut'><img id='imgTog' src='plus.jpg' border='1' width='15' height='15' /></div>
		</td>
		<td>
			<div class="divAdd">xxxxxxxxxxx zzzzzzzzzzzzzzzzzzzzz<p/>aaaaa<p/></div>
		</td>
	</tr>					
	<tr>
		<td>
			<div class='togBut'><img id='imgTog' src='plus.jpg' border='1' width='15' height='15' /></div>
		</td>
		<td>
			<div class="divAdd">xxxxxxxxxxx zzzzzzzzzzzzzzzzzzzzz<p/>aaaaa<p/></div>
		</td>
	</tr>					
	<tr>
		<td>
			<div class='togBut'><img id='imgTog' src='plus.jpg' border='1' width='15' height='15' /></div>
		</td>
		<td>
			<div class="divAdd">xxxxxxxxxxx zzzzzzzzzzzzzzzzzzzzz<p/>aaaaa<p/></div>
		</td>
	</tr>					
</table>
</body>
</html>

Open in new window

0
 
LVL 1

Author Comment

by:kyleroi
ID: 35150524
this is adding columns to the right.  How do I add/show (sorry new at the terminology) rows below.  The idea being that you click an entire row (parent) with multiple columns and a new row is created(shown) beneath.
0
 
LVL 1

Author Comment

by:kyleroi
ID: 35150796
ok, using your code I came up with this, a bit dirty but I have the general Idea now

<html>
<head>
<title></title>
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('.child').hide();

		$('.parent').click(function(){
			$('.child').hide();
			$(this).nextUntil('.parent').fadeIn('normal');

		});

	});
</script>
</head>
<body>

<p/>

<table border='1'>
	<tr class="parent">
		<td>
			Parent
		</td>
	</tr>
	<tr class="child">
		<td>
			Child
		</td>
	<tr>
	<tr class="child">
			<td>
				Child
			</td>
	<tr>
	<tr class="parent">
			<td>
				Parent
			</td>
	</tr>
		<tr class="child">
			<td>
				Child
			</td>
		<tr>
		<tr class="child">
				<td>
					Child
				</td>
	<tr>
</table>
</body>
</html>

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question