Server side search builder not working
Server side search builder not working
Hi,
I was trying to implement search builder in my serverside datatable and I'm getting an error. So I checked on the forum and I found the same error in a provided working example: https://editor.datatables.net/examples/extensions/searchBuilderTypes.html
This is the error:
dataTables.searchBuilder.min.js:43 Uncaught TypeError: Cannot read properties of undefined (reading 'office')
at c._populateCondition (dataTables.searchBuilder.min.js:43:147)
at HTMLSelectElement.<anonymous> (dataTables.searchBuilder.min.js:34:251)
at HTMLSelectElement.dispatch (jquery-3.5.1.js:5429:27)
at elemData.handle (jquery-3.5.1.js:5233:28)
There's a solution or can I have an explication of this error?
Best regards.
This question has an accepted answers - jump to answer
Answers
Your error is likely caused by a mismatch between columns defined in HTML and columns defined in JS.
The example you linked to has that problem, and obviously needs fixing.
When the call is server side you don't have any columns in HTML, but the properties in the error are the same that are defined in 'data' so I don't know where's the error.
Its an error in the current release of SearchBuilder I'm afraid. The nightly has a fix and I'll be releasing it and updating the examples on the site with the new release tomorrow.
Allan