2012-05-31 1 views
0

나는 아주 가깝게 작동하는 http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/을 매우 잘 따르지만, 이미 HTML에 테이블을 가지고있는 것 같습니다. 나중에 프로그램에서 테이블을 만든 다음 treeTable을 통해 실행하여 확장 가능한 뷰를 가져 오려고합니다. "$ (document) .ready (function()"을 제거하고 정규 함수로 바꾸고 테이블을 생성 한 후에 해당 함수를 호출하면 뷰는 예상대로 작동하지 않습니다.jquery tree 테이블이 미정 인 테이블

<!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> 

답변

0

내 자신의 질문에 대답 :.

이 밝혀를 document.write를()는 DOM에 기록되지 않았고 그래서 나는 테이블과 더 아무것도 할 수

도움이되는 사이트가 here 문제를 해결 한 것으로 밝혀졌다.

0

나는 이것을 사용한다. 코드

//Add format to the table 
$("#FormsAffected-Expandable").treetable({ expandable: true , force :true });  

테이블을 만들고이 문장을 추가하면 이름 컨트롤은 Div의 이름입니다.