Null in json data

Null in json data

snunnsnunn Posts: 17Questions: 5Answers: 0

The table doesn't seem to like: "updatedAt":null in json data. How do I handle the null case?

This question has an accepted answers - jump to answer

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    columns: function(rowData) { return (rowData.updatedAt ===null)?"":rowData.updatedAt;}

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    oops, that should be (for the appropriate column)

    columns: [{data: function(rowData) { return (rowData.updatedAt ===null)?"":rowData.updatedAt;}}]

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    For more information on using rendering functions see the rendering manual page.

    You can also use the columns.defaultContent option to tell DataTables what to do with null data.

    Allan

This discussion has been closed.