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

Using AutoComplete inside editor template

1 Answer 138 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 04 Sep 2014, 10:26 AM
I'm trying to bind kendoAutoComplete to a text element inside the editor template, which I'm doing by inlining some jquery. What I'm finding, though is that the html element appears not to have been rendered into the page at the point where the jquery is running.

<script id="editor" type="text/x-kendo-template">
        <input id="test" type="text" name="client_name" class="form-control" />
        #$('\#test').kendoAutoComplete(["Item1", "Item2", "Item3"]);#
</script>
So the binding doesn't work.

Is there some way i can do this via an mvvm attribute, or some other way of synchronising the javascript so that I can guarantee the html is rendered at the time when the js is running?

Cheers, Paul.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 08 Sep 2014, 07:07 AM
Hello Paul,

You can use the data attribute initialization:
<script id="editor" type="text/x-kendo-template">
    <input id="test" type="text" data-role="autocomplete" data-source='["Item1", "Item2", "Item3"]' name="client_name" class="form-control" />       
</script>

or a script tag:
<script id="editor" type="text/x-kendo-template">
        <input id="test" type="text" name="client_name" class="form-control" />
        <script>
            $('\#test').kendoAutoComplete(["Item1", "Item2", "Item3"]);
        <\/script>
</script>


Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Paul
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or