Problem with multiple columns

Problem with multiple columns

EmmyLEmmyL Posts: 3Questions: 2Answers: 0

I am rendering my columns with columnDefs:

"columnDefs": [ {
"targets": 5,
"render": function ( data, type, row ) {
return parseInt(data);
}

The problem is, i am rendering my tables from a flask template, and the number of columns in tables varies, from 2 to 8.

So if I define my target as 5 or -3, it gives error on pages where I have only 2 columns. Is there a different way to select target data than by using "targets"?

Answers

This discussion has been closed.