Column search not working server side - How to debug?
Column search not working server side - How to debug?

I'm working on an intranet site and can't link to my code, but maybe someone can see an error or suggest how I might debug this.
My table gets its data server-side, and normally searching works. But I'm unable to limit a programmatic search to one column; the search term is not getting passed at all in that case, and no errors are generated (and the entire table is returned).
For example, searching the entire table, like this, does work:
orgTabTable.search(_orgId).draw();
But this does not work:
orgTabTable.column({name: 'OrgID'}).search(_orgId).draw();
Neither does this:
orgTabTable.column( 1 ).search(_orgId).draw();
in both of those non-working cases, my server is not receiving the search term, eg:
{
"data": "ORGID",
"name": "OrgID",
"searchable": true,
"orderable": true,
"search": {
"value": "",
"regex": false
}
},
No errors are being generated, including in the console.
Any ideas?
Thanks in advance!
This question has accepted answers - jump to:
Answers
I did not do it that way. I appended the search criteria to the existing structure that is passed to the server in the ajax:data function so it looks something like this:
If you use the name options as you did in your code, you can search through columns until you find parms.columns[x].name == "columnName"
I think the issue is the column selector - there is no
{ name: ... }
option (that will be getting passed to theselector-modifier
.Instead use:
The full list of options for the column selectors are available in the
column-selector
documentation.That's odd. Does
_orgId
definitely have a value?Allan
Thank you, Allan!!! After fixing the syntax mistake, I was able to get it to work with the column name.
And thank you @bindrid! I also got your approach to work, and I may use it in the future.