vendredi 27 février 2015

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

I'm using http://ift.tt/1MYx188 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 criteria, as well as my sSearch: "Published" criteria. I'm pretty new to datatables so hopefully this is a simple solution.


Aucun commentaire:

Enregistrer un commentaire