Uncaught TypeError: Cannot read property 'searchBuilder' of undefined

Uncaught TypeError: Cannot read property 'searchBuilder' of undefined

lffernanlffernan Posts: 3Questions: 0Answers: 0
edited July 2021 in SearchBuilder

Link to test case:
Debugger code (debug.datatables.net):

function getReport(param) {
    $("#dtreports").show();
    var columns = [];
    $.ajax({
        url: "/api/Reports/" + param,
        success: function (result) {
            if (result.length > 0 ) {
                var columnsIn = result[0]; 
                for(var key in columnsIn){
                    columns.push({"data": key});
                } 
                var treports = $('#dtreports' + param).DataTable( {         
                    "retrieve": true,
                    "scrollY": "300px",
                    "scrollX": true,
                    "scrollCollapse": true,
                    "data": result,
                    "columns": columns,
                    "dom": 'Qlfrtip'                
                })
            } else {
                var treports = $('#dtreports' + param).DataTable()
            }
        }
    });
}

Error messages shown:

datatables.min.js:806 Uncaught TypeError: Cannot read property 'searchBuilder' of undefined
    at c._getOptions (datatables.min.js:806)
    at HTMLSelectElement.<anonymous> (datatables.min.js:799)
    at HTMLSelectElement.dispatch (jquery-3.6.0.min.js:2)
    at HTMLSelectElement.v.handle (jquery-3.6.0.min.js:2)

Description of problem:
The datatable and the searchbuilder load normally, but when I add a new condition and select the desired field, the condition and value fields do not enable, and the error reported above is verified.

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    See if this thread with the same error helps. If not please provide a link to your page or a test case replicating the problem so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • lffernanlffernan Posts: 3Questions: 0Answers: 0

    Unfortunately the post is not related to my problem. Regarding the test centário, when I tried to create I couldn't replicate the error, everything worked fine... however replicating the scene code in the environment, the error persisted.... maybe it could be some incorrect version.... I'm using in the project the version of jquery 3.6.0... see the error:

    datatables.min.js:811 Uncaught TypeError: Cannot read property 'searchBuilder' of undefined
    at c._getOptions (datatables.min.js:811)
    at HTMLSelectElement.<anonymous> (datatables.min.js:804)
    at HTMLSelectElement.dispatch (jquery-3.6.0.min.js:2)
    at HTMLSelectElement.v.handle (jquery-3.6.0.min.js:2)

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Without seeing the issue, it's hard to know what the problem is. Are you able to link to your page?

    Colin

  • lffernanlffernan Posts: 3Questions: 0Answers: 0

    Thank you very much, however when generating the link I ended up verifying that the cause of the error was in the version of the file jquery-3.6.0.min.js, I changed the location reference to Query CDN – Latest Stable Versions ready is working.

Sign In or Register to comment.