Cannot create property 'searchBuilder' on string

Cannot create property 'searchBuilder' on string

ngohangoha Posts: 3Questions: 2Answers: 0
edited June 2023 in Free community support

Error messages shown:

dataTables.searchBuilder.mjs:3388 Uncaught TypeError: Cannot create property 'searchBuilder' on string 

Description of problem:
This happens on the front end side when I set ajax.data to JSON.stringify(data) with contentType:"application/json" in order to enable serverSide processing. It seems like this is an error in the search builder package when creating searchBuilder attribute to the data while the data is being string:

this.s.dt.on('preXhr.dtsb', function (e, settings, data) {
                if (_this.s.dt.page.info().serverSide) {
                    data.searchBuilder = _this._collapseArray(_this.getDetails(true));
                }
            });

However, according to ajax document, data should be stringified so that the server can decode it. I don't know what I'm missing here.

Thank you very much for the support! Let me know if you need any other information.

Best,
Ha

Answers

  • ep_sotep_sot Posts: 2Questions: 0Answers: 0
    edited May 17

    Hi Ha
    I'm also facing this problem
    Did you find any solutions, please let me know
    Thanks

  • ep_sotep_sot Posts: 2Questions: 0Answers: 0
    edited June 26

    Hi, solution is very simple (lol)
    In AJAX, instead of using JSON.stringify(obj) in data(), please use it in beforeSend()
    Thanks

Sign In or Register to comment.