How exclude hidden element from search
How exclude hidden element from search

Hello, i have datatable with hidden div in one column.
I need this div for show data in tooltip.
Trouble: when i search - i find text in this hidden div. But i dont want.
Here js and other details
Brief example:
row:
<td>Tiger Nixon (trouble here)</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$3,120
<div style="display:none;">
<table class="table">
<thead>
<tr>
<th>UniqCode</th>
<th style="width:20%;">Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>hidden text</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</td>
Type to Search: hidden
Result: i see this row.
But if i type to input on header - all work as i want.
I'm confused.
I tried to find a solution on Google, but that cannot help me
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You can disable search for specific columns with
columns.searchable
,Colin
Thank you, but I should see the column ('Salary' in example) and should have search on the column. I can't disable search.
If i disable visible (before i moved div to new column)- column disapear from table(DOM), and i can't find hidden div for show it in tooltip.
I updated the example here
That's because you're adding them here:
Just add them to the columns you want them on, and then pass an array into
columns()
saying which ones you want there to.Colin
Sorry, I don't understand.
I create table by this code
I did not use dynamic column creation
To demonstrate the problem, enter text 'hidden' to Search field and then you will see one row which does not include the search text.
But the row contains this text in hidden div.
The row in question includes a table in the Salary column which has the word "hidden" in it. I don't understand what you are trying to do with that.
Yes, but the text is in a hidden tag.
Inside div style="display:none;".
I want the DataTable not to search inside the hidden tag.
If I input text 'hidd' to input above column 'Salary' i will see 'trouble row'.
Ah, I see, you can use
columns.render
to filter that - see here.Colin
Ouh, thank you, Colin.
This is what I need. I spent a day looking for a solution and burned gigabytes of nerve cells.
This is Colin solution from link: