Hi Kim
I looked at this and the Datatables references and came up with this starting point to change the values from javascript:
Add this line to advanced options (I also tried “initComplete”):
“drawCallback”: “function(settings,json) {settable(settings,json)}”,
This is the function ‘settable’:
function settable(settings,json) {
var table = jQuery('#'+settings.sTableId).DataTable();
var s = table.searchBuilder;
if (s != null) {
var c = s.getDetails();
c[0].value[0]='2024-01-01';
s.rebuild(c);
}
}
The intention is to change the starting date of the search to 2024-01-01 however it does not work, an exception is thrown and the searchbuilder is not displayed: Here is the exception from java console:
dataTables.searchBuilder.min.js:127 Uncaught TypeError: Cannot read properties of undefined (reading 'getDetails')
at c.getDetails (dataTables.searchBuilder.min.js:127:449)
at B.<anonymous> (dataTables.searchBuilder.min.js:146:157)
at Object.getDetails (jquery.dataTables.min.js?ver=5.2.5:122:332)
at settable (full-detail/:253:19)
at Object.eval [as userDrawCallback] (eval at convert_string_to_function (wpda_datatables.js?ver=5.2.5:732:13), <anonymous>:3:33)
at e.<computed>.drawCallback (wpda_datatables.js?ver=5.2.5:678:36)
at jquery.dataTables.min.js?ver=5.2.5:91:103
at Function.map (jquery.min.js?ver=3.7.1:2:3971)
at F (jquery.dataTables.min.js?ver=5.2.5:91:50)
at ja (jquery.dataTables.min.js?ver=5.2.5:44:108)
I understand that this a fairly complex case and I’m asking a lot of support, but is there anything similar someone has done or perhaps a completely different approach for initialising the searchbuilder?