Working With Null Values in the DataTable Columns

Working With Null Values in the DataTable Columns

zgoforthzgoforth Posts: 493Questions: 98Answers: 2

Link to test case: https://jsfiddle.net/BeerusDev/gm10rqp7/385/

Hello!

I don't know why it took me this long to realize this, but so the way the form posting to this DataTable will work is it will be updated day by day, at least some values (as others are autofilled/calculated by SharePoint for the whole week). In this case the Location/Status are the columns I am trying to Target. In my fiddle I was entering an empty string for the values then I realized until that value is updated in the SharePoint form on that day, the table is reading it as a null value! Is there a way I can render it in my columns/columnDefs(tooltips) to convert the null value to an empty string so in essence, it just appears the cell/tooltip is empty?

This question has an accepted answers - jump to answer

Answers

  • zgoforthzgoforth Posts: 493Questions: 98Answers: 2
    edited July 2021

    If my searchData.includes(api.search()) is before the other condition, it shows Invalid date, but now I fixed that

    if (mondayF == sMonday && fridayF == sFriday) {
                $('#under_txt').html("Week Of: " + moment(mondayhead).format("MMM Do YYYY"));
                    return true;
                }
                if (searchData.includes(api.search())) {
                $('#under_txt').html("Week Of: " + moment($('#dpicker').val()).startOf('isoWeek').format("MMM Do YYYY"));
                    return true;
                }
    
  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin
    Answer ✓

    In your rendering functions:

    if (data===null) {
      return '';
    }
    

    Allan

Sign In or Register to comment.