Searchable Not Working
Searchable Not Working
Hi all,
I am new to this datatables. I have some question regarding the searchable column. This is my code that is not working. I need to make the 5th column not searchable and invisible. However, this code causes the column(6) is not searchable by column(6).search("some value")
"columnDefs": [
{
"targets": [4,6],
"visible": false,
"searchable": true
},{
"targets": [ 5 ],
"visible": false,
"searchable": false
},
{ "orderable": false, "targets": [0, 7] }
]
before this it was like this (this is working but the 5th column is searchable)
"columnDefs": [
{
"targets": [4,6,5],
"visible": false,
"searchable": true
},
{ "orderable": false, "targets": [0, 7] }
]
Answers
For better readability I prefer the options to be separated:
would become
For me this way it is much easier to see which option applies to which column.
Edit: ...and if I could get the Markdown syntax formatting working, it would even look proper.
HTH, Hans
Hi,
Thank you for the reply. I am sorry im not sure how to put this in code style. I have also tried your way but so far havent got the result that i need. This is one of the code that i tried.
Sorry, I missed something in my post. Columns are visible, searchable and so on by default. So the only option there is is to switch things off (do not thing invisible, think not visible).
Thus declaring searchable true for columns 4 and 6 is redundant and seems to overwrite the setting of searchable you make before.
Hi,
Thank you again. I also tried the way that you show above. I found out what is the issue.
Before this all column are searchable, so i have total of 8 column that are searchable with index (0-7).
I am doing the searching for the 6 column from the table like this
After i put the column index 5 to searchable false. I think somehow the column count become 7 (only column 0-6 are left after the column 5 searchable is set to false). so my code must change to this
is this the way its suppose to be. or is this a bug.