Datatable not rendering.

Datatable not rendering.

Roger JarrettRoger Jarrett Posts: 2Questions: 1Answers: 0

Hi I have some data that does not render in Datatable. Data with less coloumns renders ok. A zip file containing the failing html is attached. I have sent a datatable debugger output which is uxufaj.

Any suggestions as to how to fix it would be appreciated.

This question has an accepted answers - jump to answer

Answers

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

    You are getting this error:

    Uncaught TypeError: Cannot read property 'mData' of undefined

    Looks like you have 29 columns but have only defined 28 with columns:

                columns: [
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false },
                    { orderable: false }
                ]
    

    You need to add one more column definition. You can use null if you don't want to define anything for one of the columns. Or you can replace your columns with a more simpler columnDefs, something like this:

                columnDefs: [
                  { targets: '_all',
                    orderable: false
                  },
                ]
    

    Kevin

  • Roger JarrettRoger Jarrett Posts: 2Questions: 1Answers: 0

    Thank you that did the trick.

This discussion has been closed.