About defaultContent and render options

About defaultContent and render options

yu yen kanyu yen kan Posts: 65Questions: 31Answers: 0
edited March 2017 in Free community support

I have a field using default content and render in the sametime

                  column: [{ 
                            data: date_at', 
                            title: "Date", 
                            defaultContent: "No generated",
                            render : function ( data, type, full, meta ) {
                                return new Date(data);
                            }
                        }]

the problem is empty string is still go to render function and cause min date value.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,866Questions: 1Answers: 10,520 Site admin
    Answer ✓

    columns.defaultContent is only used if the data for the column is null. Your rendering function is basically always going to override it, so you'd need to add an if condition into your rendering function.

    Allan

This discussion has been closed.