Check and Update column empty

Check and Update column empty

antoniocibantoniocib Posts: 201Questions: 41Answers: 1

Hi guys, I would like to check a column where when it is empty it must display "RITSIC" (without sending "RITSIC" to the database) instead when it is populated by the data taken from the database it must remain unchanged, I tried with rowCallback and with the function render directly in the columns but I couldn't, can you help me?

rowCallback: function ( row, data ) {       
    if ( data.start == ' ') {
            return "RITSIC";

}
},

AND

            {
                "data": "start",
                    render: function ( data, type, row ) {
                            if ( data.start == " ") {
                                    return 'RITSIC';
                            }
                        
                    },
                
            }

Replies

  • rf1234rf1234 Posts: 1,768Questions: 51Answers: 257
    edited October 17
    {
        "data": "start",
            render: function ( data, type, row ) {
                    if ( data <= '' ) {
                        return 'RITSIC';
                    }
                    return data;
            },
    }
    
  • antoniocibantoniocib Posts: 201Questions: 41Answers: 1

    Oh man, work but i need to add, cause turn me error tn4

    {
        "data": "start",
            render: function ( data, type, row ) {
                    if ( data <= '' ) {
                            return 'RITSIC';
                    }
                    
                  else {
    
                         return data;
                           
                       }
            },
          
    }
    
  • rf1234rf1234 Posts: 1,768Questions: 51Answers: 257
    edited October 17

    Sure, I updated my reply accordingly. The "else" is omittable.

Sign In or Register to comment.