簡體   English   中英

Kendo UI模板中的Javascript

[英]Javascript in Kendo UI Template

如何在劍道模板中使用常規javascript,特別是foreach?

我有:

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

但是,劍道拋出了無效的模板錯誤。

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM