ajax.reload() error in server side processing examples

ajax.reload() error in server side processing examples

kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949

I' seeing this error with this SSP example. I tired some of the other examples with the same result:

$('#example').DataTable().ajax.reload();
dataTables.js:4091 Uncaught TypeError: Cannot read properties of null (reading 'url')
    at _fnBuildAjax (dataTables.js:4091:17)
    at __reload (dataTables.js:7341:4)
    at _Api.<anonymous> (dataTables.js:7400:4)
    at _Api.iterator (dataTables.js:6744:15)
    at _Api.<anonymous> (dataTables.js:7399:15)
    at Object.reload (dataTables.js:6864:17)
    at <anonymous>:1:32

It results in a duplicated display of the Datatable:

Might be something on my side, although I cleared the Chrome browser cache. I can execute the command in the console of this test case:
https://live.datatables.net/yaroyala/24

Kevin

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I just tried that SSP example and the example you created, but I'm not seeing that error on either - both are running clean. Can you please give steps on how you generate that error.

    Colin

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949
    edited June 15

    Open the console of the example and execute $('#example').DataTable().ajax.reload();. I just tried again and get the same error. I also tried Safari with the same error.

    Kevin

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949

    The Ajax arrays example has the issue but the Ajax objects example works.

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    That's really strange, I'm still not seeing that. One for @allan! :)

    C

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    That is a weird one for sure! because of the way the site is constructed I've actually got DataTables' Javascript being loaded twice on the examples pages (once with the site-wide script, and again specifically for the examples). That is resulting in the "settings" array being overwritten. That is important as it needs to be globally unique, so we can do $(...).DataTable() to get an existing table.

    If you go to the most basic example and run $('#example').DataTable() you'll see the table controls being duplicated because of this.

    I'll look into how to fix this! Thanks for flagging it up Kevin :)

    Allan

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949
    edited June 17

    Thanks for looking. Glad you found the problem :smile:

    @colin

    That's really strange, I'm still not seeing that

    The strange part is it worked on the SSP examples then suddenly it didn't. I'm not surprised if you don't see the issue.

    Kevin

Sign In or Register to comment.