Reputation: 383
The title pretty much says it.
If I am using a kendo ui template for a listview:
<script type="text/x-kendo-template" id="myTemplate">
...
</script>
is it possible to apply styling to the parent node that will wrap around my template, using javascript WITHIN the template? In this case I wish to target the background-color
of the li
tag that will wrap around my template.
I'm not sure how to start, as I don't even know if it's possible to get a reference to the current element.. I've tried the keyword this
but it didn't work:
# this.className = "myclass"; #
As an update:
Each listview item that's created from the template is given a uid, I am investigating if it's possible to capture that specific uid and add a class to the element that way..
Upvotes: 0
Views: 745
Reputation: 2965
You can try multiple solutions: 1 create a span or a to wrap your contents inside the template and assign background color to it styles to it.
<script type="text/x-kendo-template" id="myTemplate">
<div class="#: myclass#">
<!-- tempalte contents-->
</div>
</script>
Upvotes: 1