Searchbuilder Predefined Search Not Working
Searchbuilder Predefined Search Not Working
Jargen
Posts: 8Questions: 2Answers: 0
I'm trying to use a predefined search on a datatable using serverside processing. If i do the search via the builder it works fine, but through the code nothing happens and the request isn't sent. This is the code i am using
var dataTable = $('#sample_data').DataTable({
"processing": true,
"serverSide": true,
"pageLength": 100,
"order":[],
"ajax":{
url:"fetch.php",
type:"POST",
},
dom: 'Qfrtip',
searchBuilder:{
preDefined: {
criteria:[
{
condition: '=',
data: 'Society',
origData: 'society',
type: 'string',
value: ['SOCIETYNAME']
}
],
logic: 'AND',
}
},
Answers
What version of SearchBuilder do you have? This is from the SB Server Side Processing docs.
Kevin
I am running 1.4.1, so well within that version
I copied your code here:
https://live.datatables.net/qoliyehi/15/edit
Its working. I changed
data
,origData
andvalue
to match the test case configuration.Do you get errors in the browser's console?
Can you post a link to your page or provide a test case replicating the issue so we can help debug?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Sadly there is no easy way for me to give a test case currently. However i have just found out that if i click on one of the columns to sort them then the search is applied. Is there a way to force a refresh of the table?
You can try calling
draw()
ininitComplete
. Usethis.api().draw()
.Kevin
Sadly that isn't working either. Theres no errors at all too. Is there a way I can give you access to see the page in a private way rather then on a public thread?
You can PM Allan using the Ask a Private Question button.
My example uses SB 1.4.2. I don't see anything in the release notes but maybe try upgrading to see if an issue causing the request to not be sent was fixed.
Kevin
Sorry can't see a ask a private question button, only ask a question?
@allan will need to look at that. This is the second time I've seen this comment. Try going to your inbox. Look for the button there or use the New Message button and send a message to
allan
with access details.Kevin