I created a List that is populated from an external JSON file.
But I don't like cluttering my HTML with Javascript snippets, So I thought I could just reference an external file. But that is not working:
Original: (which works)
Moving the script to an external file:
External File (Templates/TypeEntryTemplate.tmpl :
FYI: here is the code that creates the ListView:
But I don't like cluttering my HTML with Javascript snippets, So I thought I could just reference an external file. But that is not working:
Original: (which works)
<
div
id
=
"listView"
>
<
script
src
=
"Templates/TypeEntryTemplate.tmpl"
type
=
"text/x-kendo-tmpl"
id
=
"template"
>
<
div
class
=
"typeEntry"
>
<
input
id
=
"typeCheck-${idx}"
value
=
"type-${type}"
type
=
"checkbox"
checked
=
"checked"
/>
<
label
for
=
"typeCheck-${idx}"
>${type}</
label
>
</
div
>
</
script
>
</
div
>
Moving the script to an external file:
<
div
id
=
"listView"
>
<
script
src
=
"Templates/TypeEntryTemplate.tmpl"
type
=
"text/x-kendo-tmpl"
id
=
"template"
/>
</
div
>
External File (Templates/TypeEntryTemplate.tmpl :
<
div
class
=
"typeEntry"
>
<
input
id
=
"typeCheck-${idx}"
value
=
"type-${type}"
type
=
"checkbox"
checked
=
"checked"
/>
<
label
for
=
"typeCheck-${idx}"
>${type}</
label
>
</
div
>
FYI: here is the code that creates the ListView:
$("#listView").kendoListView({
dataSource:dataSource,
pageable:false,
template:kendo.template($("#template").html())
});