Can a collapsable datatable have more than 60 columns?

Can a collapsable datatable have more than 60 columns?

Tdazle007Tdazle007 Posts: 8Questions: 2Answers: 0

I have a datatable which has more than 60 columns. In fact 63. I noticed once its beyond 60, the whole table collapses. But at 60, it displays properly. Is this a bug or does datatable have a limit in columns.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923

    I noticed once its beyond 60, the whole table collapses.

    What do you mean the table collapses? Do you get errors? What is your config? Are you using server side processing?

    Datatables doesn't limit the number of columns.

    Kevin

  • Tdazle007Tdazle007 Posts: 8Questions: 2Answers: 0
    edited September 2020

    This one does. It limits. I'm also using the client side processing. Take a look at these pictures.


    The first picture has the last 3 columns: OEM Del. Lead Time, Est. Item Receipt Date and Est. Item Del. Date. Now with those 3 present, the table displays no pagination. Its suppose to hide excess columns behind each row but it doesn't. meanwhile when i remove the last 3 columns in the second picture, you have a well arranged table with pagination and sorting. What seems to be the problem.

    See below my script:

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923

    That does seem odd.

    I wonder why you have a horizontal scrollbar? It doesn't look like you enabled scrollX. Are you trying to apply the Bootstrap responsive class also?

    the table displays no pagination.

    I don't see where you applied scrollY. Not sure why you have scrolling instead of paging.

    Can you post a link to your page or a test case replicating the issue so we can take a look?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • Tdazle007Tdazle007 Posts: 8Questions: 2Answers: 0
    edited September 2020

    Thank you so much for your help Kevin. i just created a datatable live test scenario. Please see below.

    http://live.datatables.net/qeweyiji/1/edit

    If you go to that link, you'll see that when you remove the last 3 columns on each row, you get pagination. if you add them back again, pagination is lost.

    Tobore

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923
    Answer ✓

    The example is getting this error:

    jquery-3.3.1.js:3827 Uncaught TypeError: Cannot read property 'mData' of undefined at HTMLTableCellElement.

    You have malformed HTML. The last column of each row has <th><th>. You don't have the closing th tag. Replacing the last column with ``<th></th>` fixes the issue. See the updated example:
    http://live.datatables.net/fanixino/1/edit

    Kevin

  • Tdazle007Tdazle007 Posts: 8Questions: 2Answers: 0

    Thank you so much. I feel silly now lol. Thank you once more for taking the time.

This discussion has been closed.