migrating from 1.13.10 to 2.0.0, errors : DataTable is not defined - Page 2

migrating from 1.13.10 to 2.0.0, errors : DataTable is not defined

2»

Replies

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

    Ah, I see you've deleted it! This is the comment I was about to post there:

    The only obvious things I can see is that some of those elements don't exist any more, such as sAjaxSource and fnServerData - see https://datatables.net/manual/server-side#Legacy . It would be worth looking at the examples and the Ajax config options (such as ajax, ajax.data and ajax.dataSrc),

    Colin

  • chiraghapanichiraghapani Posts: 11Questions: 1Answers: 0

    Sorry! but link you provided shows me "Discussion not found."

  • chiraghapanichiraghapani Posts: 11Questions: 1Answers: 0

    below is code I have also tried, in that code, not getting any error in console but table showing "Loading..." No error in ajax response.

    var t = $(table_name).DataTable({
        scrollX: !0,
        scrollY: "400px",
        searchHighlight: !0,
        order: [],
        columnDefs: [{
            targets: [o.editdeletecol[0]],
        }],
        buttons: [],
        stateSave: !1,
        serverSide: !0,
        scrollCollapse: !0,
        paging: false,
        searching: false,
        info: false,
        ajax: {
            url: o.url,
            type: "GET",
            processing: !0,
            error: error_ServerSideGridBind_ComSetup
        },
        ordering: !1,
        columns: bindServerSideGridData(o.propertyList, o.edit, o.sendmail),
        initComplete: function () { },
        drawCallback: function () {
            bindFilters.call(this, o)
        }
    });
    
  • allanallan Posts: 63,439Questions: 1Answers: 10,459 Site admin

    Can you use the debugger to give me a trace please - click the Upload button and then let me know what the debug code is.

    Even better would be if you can provide a link to the page.

    Allan

  • chiraghapanichiraghapani Posts: 11Questions: 1Answers: 0

    Hi Allan,
    I have tried debugger.
    I am getting this:

    Access to XMLHttpRequest at 'https://debug.datatables.net/submit.php' from origin 'http://localhost:51012' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    Thank you for your help and guidance.

  • allanallan Posts: 63,439Questions: 1Answers: 10,459 Site admin

    Hmmm - that's odd. I've just tried it and it works okay on a local IP address. I'll try localhost as well and see if that makes any difference.

    For the time being, can you show me a screenshot from your browser's Network inspector showing the response from the server?

    Allan

  • chiraghapanichiraghapani Posts: 11Questions: 1Answers: 0

  • kthorngrenkthorngren Posts: 21,292Questions: 26Answers: 4,944

    The problem is the JSON response has draw: 0. It should never be 0. This is used as a sequence number and Datatables starts with 1. The initial response should be 1. See the Server Side Processing docs for details of how to handle this parameter.

    Are you using a Datatables supplied server side processing script? If so which one?

    Kevin

  • chiraghapanichiraghapani Posts: 11Questions: 1Answers: 0

    Thank you so much @kthorngren for pointing this.
    its working fine now.
    Thanks @allan @colin for your quick support.

Sign In or Register to comment.