[DT 1.10] Conditionnal columnDefs

[DT 1.10] Conditionnal columnDefs

deliatordeliator Posts: 95Questions: 1Answers: 0

Hello,

if cell #1 is equal to 10

columnDefs:[
{ targets: [ 5,6,7 ], visible: false, searchable: false },
{ targets: [ 1,2,3 ], visible: true, searchable: true }
]

if same cell is equal to 20

columnDefs:[
{ targets: [ 5,6,7 ], visible: true, searchable: true},
{ targets: [ 1,2,3 ], visible: false, searchable: false }
]

Is there a way to have only one line with an IF statement ?

Regards,

Marc

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @deliator ,

    You could run that check before before you initialise the table, and store the columnDefs in a variable, which you then use at the initialisation.

    Cheers,

    Colin

This discussion has been closed.