I tried to iterate through the list and display all elements in the list into a cell in a column but I've having trouble getting it to work.
Here is what I have so far.
In Grid definition:
columns.Bound(x => x.locationList).Title("Locations Included").ClientTemplate("#= iterate(x.locationList) #");
where x.locationList is a List<string> in the object passed in.
In <script>:
function iterate(object) {
var html = "<ul>";
for (var x = 0; x < object.length; x++) {
html += "<li>";
html += object[x];
html += "</li>";
}
html += "</ul>";
return html;
}
However, this causes all the records to disappear. What is the correct syntax to do this?
Here is what I have so far.
In Grid definition:
columns.Bound(x => x.locationList).Title("Locations Included").ClientTemplate("#= iterate(x.locationList) #");
where x.locationList is a List<string> in the object passed in.
In <script>:
function iterate(object) {
var html = "<ul>";
for (var x = 0; x < object.length; x++) {
html += "<li>";
html += object[x];
html += "</li>";
}
html += "</ul>";
return html;
}
However, this causes all the records to disappear. What is the correct syntax to do this?