Column search No matching records found

Column search No matching records found

rezzrezz Posts: 1Questions: 1Answers: 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?

Answers

This discussion has been closed.