Search code examples
kendo-uikendo-gridsparklines

How can I put kendo sparklines in all rows?


I put sparklines in the column usage, but it has only one row, how can I put all the rows in column usage?

I also put some of the Code relating to the usage column

jsfiddle code

columns: [{
         {
        field: "Usage",
        title: "Usage",
        template: '<span id="sparkline"style="line-height: 60px ; padding: 0 5px 0spx ; text-align: center" ></span>'
    }, {
        command: ["edit"],
        title: "&nbsp;"
    }],
    editable: "popup",

});

thank you


Solution

  • The problem is that you use id in a template: id must be unique.

    Change id by class

    template: '<span class="sparkline"style="line-height: 60px ; padding: 0 5px 0spx ; text-align: center" ></span>'
    

    and then in the initialization use:

    $(".sparkline").kendoSparkline({...});
    

    instead of:

    $("#sparkline").kendoSparkline({});
    

    See it here : http://jsfiddle.net/OnaBai/72KUP/embedded/result/