Hi, I have a problem with animations using jQuery on nested tables. I want to make a table that is a bit like a treeview, with a little + / - to expand and get more details about the clicked row.
How can I modify the following code for the animations to work both in Internet Explorer 6.0+ and in Firefox ?
I can change the markup or the javaScript, it doesn't matter as long as it works.
If this is useful to know, this structure is generated using nested repeaters in asp.net. I have access to the Telerik's radAjax control suite, but I haven't been able to make their radGrid work with nested tables.
Document structure:
<tr>
<th> </th>
<th>Code</th>
<th>Title</th>
</tr>
<tr>
<td><span class="TreeCollapseSign">-</span></td>
<td>WAA-864R</td>
<td>Code 1 ... some details ... - MODULE 2</td>
</tr>
<tr>
<td colspan="6">
<table>
<tr>
<th>Extra Info 1</th>
<th>Extra Info 2</th>
<th>Extra Info 3</th>
</tr>
<tr>
<td>Some info...</td>
<td>Some more info...</td>
<td>Yet more Info</td>
</tr>
</table>
</td>
</tr>
</table>
Javascript:
<script type="text/javascript">
(function($) {
$(document).ready(function(){
$(".TreeCollapseSign").data("visible", true);
$(".TreeCollapseSign").click(function(){
if ($(this).data("visible")) {
$(this).parent().parent().next().fadeOut().end().end().end().data("visible", false).text("+");
} else {
$(this).parent().parent().next().fadeIn().end().end().end().data("visible", true).text("-");
}
});
});
})($)
</script>