SearchBuilder: Why do I get different results when using SearchBuilder with a button and inline

SearchBuilder: Why do I get different results when using SearchBuilder with a button and inline

necrotosnecrotos Posts: 12Questions: 3Answers: 0
edited August 2023 in Free community support

Error messages shown:
No error messages shown, just have different result
Description of problem:
I've noticed that when I restrict multiple columns in the SearchBuilder plugin, it functions correctly with the inline SearchBuilder. However, it doesn't work as expected when using the SearchBuilder with a button. Is this a bug or maybe I miss something here?

Using inline SearchBuilder:
searchBuilder: { columns: [1, 2, 3] }, serverSide: true, dom: "<'row'<'col-12'Q>><'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",

works as expected:

Using SearchBuilder with button:
searchBuilder: { columns: [1, 2, 3] }, serverSide: true, dom: "<'row'<'col-12'B>><'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",

all the columns are visible (not expected):

and also custom condition, predefined filter are not working when using button.

I'm using the very latest version of jQuery DataTables and SearchBuilder:
https://code.jquery.com/jquery-3.7.0.js
//cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.js
https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js
https://cdn.datatables.net/searchbuilder/1.5.0/js/dataTables.searchBuilder.min.js
https://cdn.datatables.net/datetime/1.5.1/js/dataTables.dateTime.min.js

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,341Questions: 26Answers: 4,954
    Answer ✓

    Take a look at this example which states this:

    The button and SearchBuilder can be configured using the button.searchBuilder config option

    You will need to move your SearchBuilder configuration under the button config like this example.

    Kevin

  • necrotosnecrotos Posts: 12Questions: 3Answers: 0

    Oh I see, Thank you for your help, you saved my time

Sign In or Register to comment.