Unknown parameter error when re-ordering columns with different data-sort attributes

Unknown parameter error when re-ordering columns with different data-sort attributes

elnjensenelnjensen Posts: 12Questions: 4Answers: 0

Link to test case:
https://astro.swarthmore.edu/transits-testing/index.html

Debugger code (debug.datatables.net):
https://debug.datatables.net/ayunuj

Error messages shown:
DataTables warning: table id=target_table - Requested unknown parameter '[object Object]' for row 0, column 1. For more information about this error, please see http://datatables.net/tn/4

Description of problem:

Some of the columns in the example table have a data-sort attribute, and some do not (since it isn't needed if the data are simple numeric data). The above error is shown when columns are re-ordered in such a way that the ordering of columns changes the ordering of data-sort vs. non-data-sort columns. In other words, if two adjacent columns with a data-sort attribute (e.g. columns 2 and 3 in the example) are swapped, there is no error. The same is true with swapping adjacent columns with a data-sort attribute (e.g. columns 4 and 5). But if the presence/absence of this attribute differs between swapped columns (e.g. 1 and 2, where one has it and one doesn't), the error occurs. I have labeled the column headers with text showing whether or not the column has a data-sort attribute to make it easier to see what's going on.

In addition, I just noticed as I was testing this that although re-ordering columns 2 and 3 or columns 4 and 5 does not generate the error, it also does not actually swap the data in the columns! Only the headers are swapped, but the data in the columns stays in the same place. So simply adding a data-sort attribute to every column does not work around the problem, since the column re-ordering still fails to operate correctly.

This (at least the first part of it) appears to be a similar error to the one reported here. As in that case, the nightly build for ColReorder does not fix the problem; it is present both with ColReorder 1.5.6 and with the ColReorder nightly as of this writing.

Answers

  • elnjensenelnjensen Posts: 12Questions: 4Answers: 0

    Here's a simpler example, showing the failure of ColReorder when a data-sort attribute is present: http://live.datatables.net/locamabi/1/edit

    Try dragging the column headers, and observe that the data doesn't follow when column headers are re-ordered.

    Only one element of one row has a data-sort attribute; commenting out that row restores proper operation of ColReorder.

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    Many thanks for this! I'll dig into it next week and get back to you.

    Regards,
    Allan

  • elnjensenelnjensen Posts: 12Questions: 4Answers: 0

    From a bit more experimenting here, it appears that the breaking change in ColReorder in the very simple example is 1.55->1.56 (i.e. reordering the columns works OK in 1.5.5).

    However, in my own application (which uses several other Datatables extensions) it's not quite so simple, and just dropping down to 1.5.5 (or even 1.5.0) doesn't fix the problem originally reported above. So there are also some more complex interactions going on (as you likely have determined already!).

    FYI in case it's helpful.

Sign In or Register to comment.