Add a headers='' attribute to a td

Add a headers='' attribute to a td

oakmeseoakmese Posts: 9Questions: 4Answers: 0
edited January 2023 in Free community support

Hi,

I searched everywhere but I can't find the way to add the headers='' attribute to a td with Datatable.

I tried to use
ColumnDefs { targets: 0, headers: 'test' }

but it doesn't work.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,439Questions: 1Answers: 10,052 Site admin
    edited January 2023 Answer ✓

    There is no headers option for the column options, as you'll see in the full list of options.

    To do what you are looking for here, use the columns.createdCell option - e.g.:

    columnDefs: [
      {
        targets: 0,
        createdCell: function (cell) {
          cell.setAttribute('headers', 'test');
        }
      }
    ]
    

    Allan

  • oakmeseoakmese Posts: 9Questions: 4Answers: 0

    @allan thank you

Sign In or Register to comment.