Truncated text in Datatables does not appear in Excel exported file

Truncated text in Datatables does not appear in Excel exported file

GruntGrunt Posts: 5Questions: 3Answers: 0

Hi!

I am using Datatables Editor. I truncated some columns that appear in my Datatables because they are too long:

columnDefs: [
    {
        orderable:false,
        targets: [3,4,5,6,11]
    },
    {
        targets: [3,4],
        render: function ( data, type, row ){
            return type == 'display' && data.length > 100 ?
                data.substr( 0, 100 ) +'…' :
                data;
        }
    },
    {
        type: 'date-uk', 
        targets: [1,2]
    }
],

But when I export my Datatables to Excel with the export button, the truncated text appear in the cell. I would like to have the entire text (not truncated) in the cells of my Excel file.

How can I put the entire text in the cell from my excel exported file without displaying the entire text in my Datatables?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin
    Answer ✓

    Hi,

    You can make use of orthogonal data to do this. Have your rendering function handle the special orthogonal type (usually called export, but you can call it whatever you want).

    Allan

  • GruntGrunt Posts: 5Questions: 3Answers: 0

    Thanks, it works as expected!

This discussion has been closed.