2014-02-21 3 views
0

아래 코드는 knockout.js를 사용하여 테이블을 만들려고하지만 작동하지 않습니다. 테이블이 전혀 생성되지 않습니다. knockout.js를 사용하여 테이블을 만들 수 없습니다.

<html> 
<head> 
<title>Welcome to Collab-Todo</title> 
<meta name="layout" content="main" /> 
</head> 
<body> 
<h style="margin-left:px;">Welcome to Collab-Todo</h> 
<p style="margin-left:px;width:%"> 
Welcome to the Collab-Todo application. This application was built 
as part of the Apress Book, "Beginning Groovy and Grails." 
Functionally, the application is a collaborative "To-Do" 
list that allows users and their buddies to jointly 
manage "To-Do" tasks.</p><br /> 
<p style="margin-left:px;width:%">Building the Collab-Todo 
application is used to walk the user through using Grails . to 
build an application. Below is a list of controllers that are 
currently deployed in this application. Click on each to execute 
its default action:</p> 
<br /> 
<div class="dialog" style="margin-left:px;width:%;"> 
<ul> 
Hi Hello Word 
</ul> 
</div> 
Test 
         <table> 
          <thead> 
           <tr> 
            <th class="checkbox no-padding"> 
             <label> 
              <input type="checkbox" /> 
             </label> 
            </th> 
            <th> 
            300 
            </th> 
            <!-- ko foreach: columns--> 
            <th data-bind="attr: {id: id}"> 
             <div> 
              <div data-bind="html:name"></div>           
             </div> 
            </th> 
            <!-- /ko --> 
           </tr> 
          </thead> 

          <tbody >  
           <tr> 
           </tr> 
          </tbody>  
        </table> 
</body> 
<script type="text/javascript"> 
var myViewModel = { 
    columns:[ 
       {id:'title',name:'Title'}, 
       {id:'documentLanguage',name:'Document Language'}, 
       {id:'documentType',name:'Document Type'}, 
       {id:'expirationDate',name:'Expiration Date'}, 
       {id:'attachmentSize',name:'Attachment Size'}, 
       {id:'targetAccounts',name:'Target Accounts'}, 
       {id:'audienceType',name:'Audience Type'}, 
       {id:'history',name:'History'}, 
       {id:'action',name:'Action'} 
       ] 
}; 
ko.applyBindings(myViewModel); 
</script> 
</html> 

녹아웃의 바인딩 잘못 있나요, 내가 그것을 열 데이터의 각 행 값에 대한 행을 생성합니다 너무 사용하여 테이블 헤더를 만들려고하고,이

+0

녹아웃에 대한 참조는 어디에 있습니까? – christiandev

답변

0

당신과 저를 도와주세요 knockout.js에 대한 참조를 추가해야합니다. 예 :

<script src="http://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-debug.js" type="text/javascript"></script> 
+0

나는 그 줄을 헤더에 포함 시켰지만 여전히 작동하지 않는다. ( – kumar

+0

그래, 나는 그걸 알아 차렸고 http로 http://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout으로 시도했다. -debug.js하지만 작동하지 않는 svejdar ... – kumar

+0

그것은 나를 위해 작동합니까 :) http://jsfiddle.net/svejdo1/sDYE6/ –

관련 문제