Why is fixedColumns giving me this error?

Why is fixedColumns giving me this error?

thegamechangerprothegamechangerpro Posts: 81Questions: 30Answers: 1

The row number changes based on how the table is sorted, but this is the error I get:

DataTables warning: table id=table - Requested unknown parameter '4' for row 12, column 4.

I ONLY get it if I use this:

fixedColumns: {left: 3},

It doesn't matter how many fixed columns of my 25 columns I have.

It also doesn't matter if I remove that 4th column from my dataset completely.

Is it obvious to anyone or will I have to create a whole santized dataset to create jsfiddle?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,401Questions: 26Answers: 4,787
    edited February 29

    There is something specific with the in that row ( 12 ) that doesn't line up with what Datatables expects in that row. See this section from the technote linked in the error for ideas to look at.

    Likely it doesn't have to do with FixedColumns being enabled.

    To troubleshoot we will need a test case showing the issue. Instead of a test case, possibly the debugger might help Allan look at the table data to see the issue. Provide the updated Requested unknown parameter '4' for row 12, column 4 part of the error along with the upload code.

    Kevin

  • thegamechangerprothegamechangerpro Posts: 81Questions: 30Answers: 1

    Hi Kevin,

    Thanks for the reply. I think it is to do with how my columns are defined as in the technote...

    It all seems to be working correctly, minus the error.

    Here is a fiddle of it happening. i hope you have some suggestions!
    https://jsfiddle.net/thegamechangerpro/sb8e576z/2/

    FYI... These Values are dynamic which is why I am building the columns the way i am..
    const columns = [
    "04/19", "04/20", "04/21", "04/22", "04/23", "04/24", "04/25", "04/26", "04/27", "04/28", "04/29"...];

    I am going to turn off fixedColumns for the time being since that seems to fix the error. But I look forward to what you or Allan have to say!

  • kthorngrenkthorngren Posts: 20,401Questions: 26Answers: 4,787
    Answer ✓

    The problem is with your columnDefinitions variable. You are using columns.data to define the first 4 columns. columnDefinitions is starting with column 5 (index column 4) which is where the error is indicating. You haven't defined columns.data for these columns which is causing the error. Use data: null to tell Datatables to use the full row of data. More info can be found in the columns.data docs. Updated example:
    https://jsfiddle.net/5duqvr7x/

    Kevin

Sign In or Register to comment.