sNewLine equivalent?

sNewLine equivalent?

vetezeveteze Posts: 6Questions: 1Answers: 0
edited February 2016 in Buttons

How would I do the equivalent of "sNewLine" from the old "oTableTools" / "aButtons" params? I have a button that lets people get a list of comma separated IDs from all of the rows.

buttons: [
    {
        extend: 'copyHtml5',
        text: 'Copy IDs',
        header: false,
        //rowSeparator: ', ', 
        exportOptions: {
            columns: [3]
        }
    },
],

Answers

  • allanallan Posts: 61,642Questions: 1Answers: 10,092 Site admin

    There is no option for that in Buttons. What you would need to do is use the customize option of the copyHtml5 button type to modify the data to suit your needs.

    Allan

  • vetezeveteze Posts: 6Questions: 1Answers: 0

    i figured that, but i can't find any examples of the use of customize anywhere. i'll see if i can hack it together from the description of customize.

  • vetezeveteze Posts: 6Questions: 1Answers: 0

    this does exist as a config param actually. in my efforts to figure out customize I discovered it in buttons.html5.js. Yahoo. It's just newLine.

    buttons: [
        {
            extend: 'copyHtml5',
            text: 'Copy IDs',
            header: false,
            newLine: ', ',
            exportOptions: { columns: [3] }
        }
    ],
    

    unrelated: I noticed is that config.customize is called after _exportData( dt, config ); If you're working with large datasets the customize call has to wait for it to first process data the default way and then it gets overwritten with the customized version. Maybe skip _exportData if customize is set.

  • allanallan Posts: 61,642Questions: 1Answers: 10,092 Site admin

    I had a feeling it was in there, but it was missing from the documentation. Doh - sorry.

    I've committed the change and it will be published on the site shortly.

    Maybe skip _exportData if customize is set.

    Customize is really there to allow the data that _exportData gathers or sets up to be customised. it is possible to use the DataTables API to get your own data, but that wasn't the primary goal of that option.

    Allan

This discussion has been closed.