columnControl with search and colReorder

columnControl with search and colReorder

rweigelrweigel Posts: 4Questions: 2Answers: 0

See https://jsbin.com/vezufohuxi/edit?html,output

In the following configuration colReorder does not work with columnControl

          colReorder: {order: [0,2,1]},
          columnControl: [
                {target: 0, content: ['order']},
                {target: 1, content: ['search']}]

Throws an error

Uncaught TypeError: Cannot read properties of null (reading 'startsWith')

No error if order = [0, 1, 2] or {target: 1, content: ['search']} is removed.

I can move columns after table creation by not setting colReorder in config and using

table.colReorder.order([0,2,1])

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,162Questions: 1Answers: 10,796 Site admin
    Answer ✓

    Many thanks for the example! You've actually uncovered a bug in DataTables there! The column().type() method is meant to resolve a column's data type if it is unknown (it is invalidated by the column reordering), and it does do that, but wasn't returning the resolved value!

    I've committed a fix to address that.

    Your example works when updated to use the nightly build of DataTables. The change will be included in the next patch release.

    Allan

Sign In or Register to comment.