Issue with ColReorder, ColVisibility, and StateSave Functionality in DataTables

Issue with ColReorder, ColVisibility, and StateSave Functionality in DataTables

jose_fonsecajose_fonseca Posts: 4Questions: 2Answers: 0

Link to test case: https://datatables.net/extensions/colreorder/examples/integration/colvis.html
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Hey everyone

While working with DataTables, specifically when utilizing ColReorder, ColVisibility, and StateSave, I encountered a persistent bug that affects the table's usability. When these features are used together, the table displays incorrect results after a refresh.

For example, if the initial column order is A > B > C, and I rearrange it to A > C > B and then hide column B, upon refreshing the table, the visible columns incorrectly show as A > B, with column C remaining hidden despite it being previously visible.

Additionally, I noticed that the example on this page (https://datatables.net/extensions/colreorder/examples/integration/colvis.html) has the StateSave functionality disabled, which prevents me from testing the issue thoroughly.

Thank you in advance for your help and any suggestions to resolve this issue.

Best regards,
JF

Answers

  • kthorngrenkthorngren Posts: 21,799Questions: 26Answers: 5,042

    Additionally, I noticed that the example on this page (https://datatables.net/extensions/colreorder/examples/integration/colvis.html) has the StateSave functionality disabled, which prevents me from testing the issue thoroughly.

    This page provides options to allow you to build simple test cases to test out feature combinations that aren't in the examples. You can use the Download Builder to get all the needed libraries for the test case.

    Here is a test case with the linked example) and stateSave.
    https://live.datatables.net/fovuduzu/1/edit

    Everything seems to work correctly. I tried these steps:

    1. Swap Position (B) and Office (C) columns
    2. Hide Position
    3. Use the Run with JS button to reload the output table or fully refresh the page
    4. Office is still visible and Position remains hidden

    Possibly you are using old versions which might have a bug. Feel free to update the test case to show the error.

    Kevin

Sign In or Register to comment.