SearchPanes: Finding the selected values
SearchPanes: Finding the selected values
Thanks for your help so far!
I am busy trying to write a server side script for a custom button to search my database, and I need to get the search parameters in order to see what has been posted. I have found the following (as per your previous assistance and some further searching the forums:
var globalSearch = dt.search();
var columnSearch = dt.columns().search();
Which contains the search values for global and columns.
I am still in need of the search values for the searchPanes, with their associated filter "name". I found this answer by Sandy:
$(".dtsp-searchPane table:visible").each(function(t) {
console.log($(this).DataTable().rows({selected: true}).data().toArray());
})
While that gives me the values selected, I cannot for the life of me figure out how to see which search pane each of the selected arrays of values are associated with. I need to know, for example, that values "MIS-15" and "MIS-16" are selected in the "Tracking Code" search pane. I only have the values MIS-15 and MIS-16 in the above code, not the name (or even the index/target) of the search pane, obviously.
I tried toArray() as follows, but do not know how to interpret the vast if information provided there:
$(".dtsp-searchPane table:visible").each(function(t) {
console.log($(this).DataTable().toArray());
})
Please advise? I cannot find an example doing what I am trying to achieve. I am a back-end PHP programmer, so JS is a bit baffling to me. :-)
Thanks in advance!
Answers
I figured this out from some other example, and it looks like it is working. If there is a better way than this, can you plese advise?
The above is working well enough for me. You can close this question - does not look like there is a way I can mark my own comment as being a solution? Thank you!