简体   繁体   English

Kendo UI模板中的Javascript

[英]Javascript in Kendo UI Template

How can I use regular javascript, specifically a foreach, in a kendo template? 如何在剑道模板中使用常规javascript,特别是foreach?

I have: 我有:

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

However Kendo is throwing an invalid template error. 但是,剑道抛出了无效的模板错误。

Your for loop syntax isn't correct; 您的for循环语法不正确; you have to use semicolons: 您必须使用分号:

# 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