Can't seem to add a searchbuilder filter manually via javascript
Can't seem to add a searchbuilder filter manually via javascript
I'm trying to do this, but it doesn't seem to work:
var filter = "{" +
" \"criteria\": [" +
" {" +
" \"condition\": \"=\"," +
" \"data\": \"Trailer Number\"," +
" \"type\": \"string\"," +
" \"value\": [" +
" \"110528\"" +
" ]" +
" }" +
" ]," +
" \"logic\": \"AND\"" +
"}";
alert(filter);
$('#tblReport').DataTable().searchBuilder.rebuild(filter);
this:
https://www.datatables.net/reference/api/searchBuilder.rebuild()
doesn't tell you how to define your own filter?
Answers
I just needed to do this:
$('#tblReport').DataTable().searchBuilder.rebuild(JSON.parse(filter));