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

ListView template becomes empty

1 Answer 94 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Irit
Top achievements
Rank 1
Irit asked on 25 Jun 2012, 07:53 AM
Hello,

I try to use the ListView widget according to the documentation.
I created a list in my HTML as following:
<ul id="listView"></ul>

Then, I copy-pasted the example in the demo:

$("#listView").kendoListView({ 
         dataSource: {
          data: [{title: "Star Wars: A New Hope", year: "1977"}, {title: "Star Wars: The Empire Strikes Back", year: "1980"}]
 },
 template: "<li>${title} ${year}</li>"
});

But when I run it, the code in the browser looks like this: 
$("#listView").kendoListView({
dataSource: {
data: [{title: "Star Wars: A New Hope", year: "1977"}, {title: "Star Wars: The Empire Strikes Back", year: "1980"}]
},
template: "<li> </li>"
});

as You can see, the template is empty for some reason...

I also noticed that in the examples the template is sometimes inside the dataSource property, like this:
dataSource: {
         data: [{title: "Star Wars: A New Hope", year: "1977"}, {title: "Star Wars: The Empire Strikes Back", yearI : "1980"}],
template: "<li>${title} ${year}</li>"
}

And sometimes like in my first code example, I wonder what is the correct syntax?.. (I tried both.. Same result with the template)

I wonder what am I doing wrong?

Any help would be appreciated.
Thanks,
Irit.

1 Answer, 1 is accepted

Sort by
0
Iliana Nikolova
Telerik team
answered on 27 Jun 2012, 08:56 AM
Hi Irit,

I tried to reproduce your scenario and everything works as expected. You could find my test project attached, please check it and let me know if I missed something.

On a side note, templates are configuration options of the Kendo UI widgets and specify the visualization of the particular widget. Hence, the template should not be inside the DataSource.

You could find more detailed information about the templates and their configuration option in our online documentation.
  
Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView
Asked by
Irit
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
Share this question
or