Filtering specific value of specific column
Filtering specific value of specific column
javismiles
Posts: 205Questions: 38Answers: 3
in Editor
Hi,
I'm trying to use this
"aoSearchCols": [
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{ "sSearch": "peter" },,null,null,null,null,null,null,null,null,null,null],
to filter column 21 of a table,
it's not working yet but anyway is there an easy way?
so that I don't have to list the 31 columns to just filter column 21 of the table?
thank you
This discussion has been closed.
Replies
If you are using a current version (1.10) of Datatables then you will want to use the current for of the options, for example:
searchCols
.According to the doc the array needs to be the same length as the number of columns.
If you don't want to define 20 null columns then maybe you can use
columns().search()
. You can place it withininitComplete
to execute once the table has initialized.Kevin
mmm, I see, what about,
is it possible to do a search based on an SQL query?
like init the table in connection with a specific SQL query like
"SELECT * from table where org='whatever'
thank you again
Not sure what your config is but one option is to use the
data
parameter to send data you want to search to your server. Your server code would need to parse the parameters sent to perform the sql query.You can read about the jQuery ajax parameters here:
http://api.jquery.com/jquery.ajax/
Kevin