Handling null values in Kendo Grid Column Templates

2 posts, 0 answers
  1. Nag
    Nag avatar
    2 posts
    Member since:
    Jun 2016

    Posted 07 Jun 2016 Link to this post

    I have a kendo grid in which one column can have null values. But I don't see the grid populating when there are null values. My code is here:

    $(document).ready(function() {


    dataSource: gridData,

    columns: [

    { field: "name", title: "Name"},

    { field: "result",

    title: "Result",

    template: "# if (result == null) { #" +

    "<span data-content=' '></span> } #" +

    "# } else { #" +

    "<span data-content=\"#: result#\"> </span>"}]})

    I don't get the grid shown when the "result" is null. However, I can get the grid when the value is not null. Not sure on how to handle the null values in templates.

  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2312 posts

    Posted 09 Jun 2016 Link to this post

    Hello Nag,

    There is a curly bracket on the second row of the template that is not needed and breaks the syntax. Here is the updated version.

    Dimiter Madjarov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top