Check and Update column empty

Check and Update column empty

antoniocibantoniocib Posts: 277Questions: 62Answers: 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: 2,801Questions: 85Answers: 406
    edited October 2020
    {
        "data": "start",
            render: function ( data, type, row ) {
                    if ( data <= '' ) {
                        return 'RITSIC';
                    }
                    return data;
            },
    }
    
  • antoniocibantoniocib Posts: 277Questions: 62Answers: 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: 2,801Questions: 85Answers: 406
    edited October 2020

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

This discussion has been closed.