rowReorder has started adding extra rows

rowReorder has started adding extra rows

cj1005cj1005 Posts: 148Questions: 47Answers: 1

Link to test case: https://www.wd4g.com/WCGateway/rowReorder_Debug.wc
Debugger code (debug.datatables.net): n\a
Error messages shown: no error message
Description of problem:
rowReordering was working fine until recently, now each time we do a rowReorder (or just drag the row to the top of the dt) we get a new rows inserted above the actually data rows (but below the column headers), this new row contains the datatables_length elements, and the datatable_filter elements. Also, we get a new rows below the data rows, (but above the table footer), this row contains the datatable_info and datatable_pagnation elements. This happen for each rowReOrder, so it duplicates each time.

I have tried removing all recent global changes to do with datatables, but the issue remains.

So, I'm struggling to find the cause of this issue.
If someone could please take a look and offer any advice that would be really appreciated.

Thanks, Chris

Answers

  • cj1005cj1005 Posts: 148Questions: 47Answers: 1

    To add some more information to this, I have discovered that the structure of the table has been changed dynamically, so that the <tbody> element now sits below the <tfoot> (which I believe is causing the rowReorder to fail), but the table structure is correct at the point of sending the webpage code back to the browser, so it seems something is manipulating the table structure after the page is loaded into the browser. So, the real problem is probably nothing to do with rowReorder.

  • allanallan Posts: 65,286Questions: 1Answers: 10,822 Site admin

    Hi Chris,

    rowReordering was working fine until recently

    What changed? Do you upgrade from one version to the latest, or was there a document change, or something else?

    Unfortunately the link doesn't appear to be loading for me at the moment, stalling while getting something from cdn.getaddress.io - I'll try again later.

    Allan

  • cj1005cj1005 Posts: 148Questions: 47Answers: 1

    Hi Allan,

    Yes, it is all happening today, unknown to me that CDN has expired, but the script file for this is local now, so should work ok now.

    I have done quite a few changes over the last few months, and they all seem to be working well, but it is highly likely this could be a consequence of one of these changes.

    The one I change I made that feels the most likely cause is we wanted a way to allow users to change Boolean\logical fields quickly, but not using the inline editing or an edit form, so we implemented a footer toggle button which sits below its respective column, which when clicked updates the selected rows related field. This is working, but I have a feeling it inserts a second footer to control this, and hides the default datatable footer, so this maybe the cause.

    But, I did disable this code as one of my tests, and the issue remained, so I'm not quite sure if it is the cause, or maybe I missed something when disabled the code, I'll double check now.

    I'll keep debugging here, but if you do get a chance to look at it then that would be really appreciated.

    Thanks, Chris

  • cj1005cj1005 Posts: 148Questions: 47Answers: 1

    ps. We have not upgraded the datatable libraries

  • allanallan Posts: 65,286Questions: 1Answers: 10,822 Site admin

    DataTables 1.10.18 - gosh, that's an old version! Something is causing the table to re-initialise when dropped.

    I've just been digging around, but I don't immediately see what would be causing that. Do you have anything rewriting the table's HTML? If it used to work, but no longer is, a diff with the old version might yield something interesting.

    Allan

  • kthorngrenkthorngren Posts: 22,307Questions: 26Answers: 5,127

    Looks like you have duplicated code in the script.

    I see two script tags with what looks like duplicated code including this:

        $.fn.dataTable.ext.errMode = 'none';
    
            qsjobTable = $("#dtqsjob").DataTable({
    

    The first script tag starts on line 163 and the other on 749. Try removing the contents of one of them to see if it helps.

    Kevin

Sign In or Register to comment.