How to use "_all" and specific target together?

How to use "_all" and specific target together?

DrujikDrujik Posts: 5Questions: 1Answers: 0

I have a columnDefs that come from some object and it looks like this

{
      targets: '_all',
      createdCell: function(td, cellData, rowData, row, col) {
         if(cellData == 0.01){
            td.className += " numberIsLower";
         }
      }
   }

Now in my specific table I also want to use some method for "createdCell" only for specific target

{
      targets: '1',
      createdCell: function(td, cellData, rowData, row, col) {
         //// Some code
      }
   }

I do merge between two columnDefs and render a DataTable with united columnDefs, but the thing is that I don't see that the code of my specific target is executing.

What am I doing wrong?

This question has an accepted answers - jump to answer

Answers

  • DrujikDrujik Posts: 5Questions: 1Answers: 0

    I do merge this way
    columnsDefs = baseColumnsDef.concat(customColumnsDef)

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Answer ✓

    You can only have one columns.createdCell function per column. Merging the arrays won't allow it to run both functions I'm afraid.

    Beyond that, could you link to a page showing the issue, or perhaps show a more complete code example of how you are using it please.

    Allan

  • DrujikDrujik Posts: 5Questions: 1Answers: 0

    Thanks

This discussion has been closed.