Setting a column type and using createdCell doesn't let column sort

Setting a column type and using createdCell doesn't let column sort

anaganag Posts: 48Questions: 2Answers: 7

I've got the following object in columnDefs the cell data is inserted with createdCell the count is an integer. Sorting does not work when clicking the column header. I'm guessing because the cell data is added with createdCell.

"targets": 6,
"type": "num",
"createdCell": function (td, cellData, rowData, row, col) {
const count = cellData.length > 0 ? cellData.length : null;
$(td).html(count);
},

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765
    Answer ✓

    I suspect you will want to use columns.render instead when trying to set the data of the column.

    Kevin

This discussion has been closed.