node-datatable, how to modify search criteria on the server

node-datatable, how to modify search criteria on the server

dpouliotdpouliot Posts: 1Questions: 1Answers: 0

I'm using https://github.com/jpravetz/node-datatable and I so far have a working site, it uses the ajax server-side options for the datatable jquery plugin. However, the search criteria currently are driven solely by the client. I'd like to enforce certain search criteria at the server (e.g. omit status=draft, or privacy=private from the search result).

in node I've set up the following:

var questionnaireTableDef = { sCountColumnName: "'questionnaire'", sDatabase: "bdp", sTableName: "questionnaire", "sSearch": "", "sSearch_0": "test", aoColumnDefs: [ { mData: "name", bSearchable: true }, { mData: "inviteCode", bSearchable: false }, { mData: "tags", bSearchable: true }, { mData: "publishDate", bSearchable: false }, { mData: "status", bSearchable: false, sSearch: "Published" } ], aoSearchCols: [ { sSearch: "2009" }, null, null, null, { sSearch: "Published" } ] };

and in the client I am using

$.fn.dataTable.ext.legacy.ajax

to use the legacy data scheme, but datatables seems to ignore my aoSearchCols params, as well as sSearch: "Published". I'm pretty new to datatables so hopefully this is a simple solution.

This discussion has been closed.