Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82360

Column search No matching records found

$
0
0

Hello guys,

im building a table that allows users to filter columns. My problem is that i have more than 1 field per column

example:

    <td>
        <span style="text-align: center; display: block;">
            <div><i class="fas fa-phone"></i> 999999999 </div>
            <div><i class="far fa-envelope"></i> email@email.com </div>
        </span>
    </td>

How can i use this to allow filters? i already tried to add a class example:

    <td>
        <span style="text-align: center; display: block;" class="search">
            <i class="far fa-envelope"></i> email@email.co
        </span>
        <div><i class="fas fa-phone"></i> 999999999 </div>
    </td>

and in my code:

column.data().unique().sort().each( function ( d, j ) {
const search = $.parseHTML( d );
for(let i = 0; i<=search.length; i++) {
if(search[i] != undefined) {
try {
if(search[i].classList.contains('search')){
select.append( '<option value="'+search[i].innerHTML+'">'+search[i].innerHTML+'</option>' )
}
} catch(e) {
}
}
}

but this doenst work too, any help?


Viewing all articles
Browse latest Browse all 82360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>