2015-02-10 97 views
0

如何在kendo模板中使用常規JavaScript,特別是foreach?Kendo UI模板中的Javascript

我:

<script id="partsTemplate" type="text/x-kendo-template"> 
    <div class="k-grid k-widget k-secondary"> 
     <table> 
      <colgroup> 
       <col style="width:70px"> 
       <col style="width:70px"> 
       <col style="width:120px"> 
       <col> 
       <col style="width:30px"> 
      </colgroup> 
      <thead class="k-grid-header"> 
      <tr> 
       <th role="columnheader" class="k-header"><b>Quantity</b></th> 
       <th role="columnheader" class="k-header"><b>Type</b></th> 
       <th role="columnheader" class="k-header"><b>Manufacturer</b></th> 
       <th role="columnheader" class="k-header"><b>Part</b></th> 
       <th role="columnheader" class="k-header"><img src="/laravel/public/images/icons/magnifier_zoom_in.png"></th> 
      </tr> 
      </thead> 
      <tbody> 
      #for(var i=0, i<10, i++){# 
       <tr><td>5</td><td>5</td><td>5</td><td>5</td></tr> 
      # } # 
      </tbody> 
     </table> 
    </div> 
</script> 

但是劍道拋出一個無效的模板錯誤。

回答

0

您的for循環語法不正確;你必須使用分號:

# for (var i=0; i<10; i++) { # 
    <tr><td>5</td><td>5</td><td>5</td><td>5</td></tr> 
# } #