template

specifies a template for DataView items

function template;

Example

var dataview = new dhx.DataView("dataview", {
    itemsInRow: 4, 
    template: function template(item) {
        var template = "<div class='item_wrap'>";
        template += "<img class='image' src=" + "..images/" + item.thumbnailName + " />";
        template += "<h2 class='title'>" + item.value + "</h2>";
        template += "<p class='description'>" + item.shortDescription + "</p>";
        template += "</div>";
        return template;
    }
});

Related samples

Details

The template function takes one parameter:

  • item - (object) an object of a data item
See also
Back to top