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

Listview template not executed

1 Answer 100 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Alon
Top achievements
Rank 1
Veteran
Alon asked on 28 Nov 2016, 02:53 PM

I currently have the following template

 

    <script id="tmplOptionsMenuItemRowAll" type="text/x-kendo-tmpl" >
        <div>#:uid#</div>
        <div class="col-xs-12"
            data-role="listview"
            data-template="tmplOptionsMenuItemRowAll"
            data-bind="source: allMenuItems"
            data-selectable="false"
            id="kendoLVOptionsAllMenuItems">
        </div>
    </script>

 

I am trying to manually calculate the HTML and then inserting it somewhere in the DOM (its a long story)

I currently call the following code to do this:

               var templateContent = $(options.templateId).html();

                var template = kendo.template(templateContent);
                //now resolve the HTML
                var result = kendo.render(template, [options.appModel]); //render the template
                return result;

 

However when I look at 'result' I can see that the UID has been correctly resolve BUT the list view has not been executed at all. Am I missing something?

1 Answer, 1 is accepted

Sort by
0
Alon
Top achievements
Rank 1
Veteran
answered on 28 Nov 2016, 03:26 PM

OK Never mind. I was able to get the HTML after I did the call to kendo.bind and the inject it into the DOM where I wanted it

The code was as follows:

        kendo.bind($(options.divId), options.appModel);<br>        var templateContent = $(options.divId).html();
Tags
Templates
Asked by
Alon
Top achievements
Rank 1
Veteran
Answers by
Alon
Top achievements
Rank 1
Veteran
Share this question
or