0

I am using a Jquery plugin, treeTable for displaying a html table. http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/ My code is below :

<html>
<head>
<link href="treeTable/src/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="treeTable/src/javascripts/jquery.treeTable.js"></script>

<script type="text/javascript" src="treeTable/doc/javascripts/jquery.js"></script>
<script type="text/javascript" src="treeTable/doc/javascripts/jquery.ui.js"></script>

<script>

  $(document).ready(function() {
    $('.type_struct_class').treeTable({
        initialState: 'collapsed'
        });
    $('table#type_struct tbody tr').mousedown(function() {
        $('tr.selected').removeClass('selected'); 
        $(this).addClass('selected');
    });
    $(\"table#type_struct tbody tr span\").mousedown(function() {
        $($(this).parents(\"tr\")[0]).trigger(\"mousedown\");
    });





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

<table class='type_struct_class' id='type_struct'>
  <tr id="node-1">
    <td>Parent</td><td>100</td><td>1000</td>
  </tr>
  <tr id="node-2" class="child-of-node-1">
    <td>Child</td><td>200</td><td>2000</td>
  </tr>
  <tr id="node-3" class="child-of-node-2">
    <td>Child</td><td>300</td><td>3000</td>
  </tr>
</table>

</body>
</html>

I don't see the table formatted, as like with child and parent nodes. It appears as a normal table in my Chrome browser. Can anyone help where I went wrong?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Somnath Paul
  • 190
  • 1
  • 6
  • 17

2 Answers2

1

I found the the integration of jQuery tree table and Atlassian products difficult and wrote a compatible clone of the script. It has some helper functions for dynamically generating the tables too: you can give it a try: http://culmat.github.io/jsTreeTable/

BenMorel
  • 34,448
  • 50
  • 182
  • 322
culmat
  • 1,156
  • 11
  • 12
0

Try this out :- http://jsfiddle.net/adiioo7/6mtnL/

$(document).ready(function () {
    $('.type_struct_class').treeTable({
        initialState: 'expanded'
    });
    $('table#type_struct tbody tr').mousedown(function () {
        $('tr.selected').removeClass('selected');
        $(this).addClass('selected');
    });
    $("table#type_struct tbody tr span").mousedown(function () {
        $($(this).parents("tr")[0]).trigger("mousedown");
    });
});
Aditya Singh
  • 9,512
  • 5
  • 32
  • 55