columnDefs className: is concatenation behavior intended?

columnDefs className: is concatenation behavior intended?

NeroMJNeroMJ Posts: 1Questions: 1Answers: 0

Link to test case:
1.10.25 - https://codepen.io/NeroMJ/pen/YzazwXG
1.12.1 - https://codepen.io/NeroMJ/pen/bGvGVPa

Description of problem:
Hi,
I recently updated from version 1.10.25 to 1.12.1 and noticed that className in columnDefs seems to behave differently now.

    columnDefs: [
        { targets: [0, -1], className: 'text-success'}, 
        { targets: '_all', className: 'text-danger' },
    ]

In v1.10.25, in this case, the first and last columns would only have the 'text-success' class and all others 'text-danger'.
In v1.12.1, it seems that the first and last columns have both 'text-success' and 'text-danger' classes.

Is this the intended behavior?
And if that's the case, is there a different way to achieve this, apart from setting the desired classes on all columns individually?

(It seems like the table headers in v1.10.25 already had this concatenation behavior)

Thanks,
Nero

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 56,819Questions: 1Answers: 9,030 Site admin
    Answer ✓

    Hi Nero,

    Yes that was an intentional change, committed here with the discussion that lead to it here.

    I can see how it will cause issues in your own use case though. You are correct, with 1.12+ you'll need to assign them individually rather than having them override. I need to have a think about how we might be able to do that as well as keeping the newer implementation...

    Allan

Sign In or Register to comment.