我下面http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/相當密切,偉大的工程,但似乎我必須已經有一個表中的HTML。我想稍後在程序中構造一個表格,然後通過treeTable運行它以獲取可展開的視圖。當我擺脫了「$(文件)。就緒(函數()」,並定期更換功能,然後調用這個函數構建表後,認爲不工作像它應該。jQuery的treetable中與未確定表
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery/jquery.js"> </script>
<link href="./jquery/jquery.treeTable.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./jquery/jquery.treeTable.js"></script>
<script type="text/javascript">
function init() {
createTable();
$("#pathTable").treeTable();
}
</script>
<script type="text/javascript">
function createTable() {
document.write('<table id="pathTable"><tbody>');
document.write('<tr id="node-0"><td>node0</td></tr>');
document.write('<tr id="node-1" class="child-of-node-0">');
document.write('<td>node1</td></tr>');
document.write('<tr id="node-2" class="child-of-node-1">');
document.write('<td>node2</td></tr>');
document.write('</tbody></table>');
}
</script>
</head>
<body onload="init()">
</body>
</html>