This is a migrated thread and some comments may be shown as answers.

Weird Behaviour

2 Answers 59 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Wayne Hiller
Top achievements
Rank 1
Veteran
Iron
Wayne Hiller asked on 25 Feb 2015, 12:23 AM
I have a template that gets data bound. 

<script type="text/x-kendo-template" id="filtering-template">
    <table class="edit-panel">
        <colgroup>
            <col class="fields-col">
            <col class="operator-col">
            <col class="value-col">
            <col class="delete-col">
        </colgroup>
        <tbody data-template="filtering-row-template" data-bind="source: filter.Rows"></tbody>
    </table>
    <a id="add-filter-row" data-role="button" data-bind="click: addRow">Add</a>
</script>

In this format the link at the bottom does not get set to a kendo button.
If I change the order to this:

<script type="text/x-kendo-template" id="filtering-template">
    <a id="add-filter-row" data-role="button" data-bind="click: addRow">Add</a>
    <table class="edit-panel">
        <colgroup>
            <col class="fields-col">
            <col class="operator-col">
            <col class="value-col">
            <col class="delete-col">
        </colgroup>
        <tbody data-template="filtering-row-template" data-bind="source: filter.Rows"></tbody>
    </table>
</script>

Then the button gets created correctly but the body of the table never gets created.

There are no JS errors being displayed at all.







2 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 25 Feb 2015, 11:23 AM
Hi,

the templates need a single root element to work as expected - try wrapping the two elements in a div.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Wayne Hiller
Top achievements
Rank 1
Veteran
Iron
answered on 26 Feb 2015, 12:28 AM
That fixed it, Uggg, it was driving me nuts lol. You should put that in the docs in BIG red letters.

Thanks you very much :)
Tags
Templates
Asked by
Wayne Hiller
Top achievements
Rank 1
Veteran
Iron
Answers by
Petyo
Telerik team
Wayne Hiller
Top achievements
Rank 1
Veteran
Iron
Share this question
or