Can't seem to add a searchbuilder filter manually via javascript

Can't seem to add a searchbuilder filter manually via javascript

woodsalexjwoodsalexj Posts: 21Questions: 6Answers: 0

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

  • woodsalexjwoodsalexj Posts: 21Questions: 6Answers: 0

    I just needed to do this:
    $('#tblReport').DataTable().searchBuilder.rebuild(JSON.parse(filter));

Sign In or Register to comment.