I have a table that contains alot of data. i want my users to be able to search for any of the given fields and if a match is found the complete table row will be visible.
I started out by doing something like this:
    $('.table_column').each(function(){
    var content = $(this).html();
    if(!content.toUpperCase().contains(value.toUpperCase())){
        $(this).hide()
    }
});
However i quickly realised that this would just hide all the columns that doesnt match so this didnt work.
my table struckture looks like this:
<?php if (isset($vars['excel'])): ?>
<table class="table table-striped table-bordered table-hover" id="<?php echo $vars['list_id']?>">
    <thead>
        <tr>
            <th class="table-header">
                <input type="checkbox" id="select_all"/>
            </th>
            <th class="table-header">
                <img src="/site/resources/images/outlook.png">
            </th>
            <th class="table-header">
                <i class="fa fa-phone"></i>
            </th>
            <th id="phone_sort" class="table-header"> Telefon  <i class="fa fa-angle-down" style="float: right;"></i>
                <span class="hidden">sort_asc</span>
            </th>
            <th id="company_sort" class="table-header">
                Selvskab <i class="fa fa-angle-down" style="float: right;"></i>
                <span class="hidden">sort_asc</span>
            </th >
            <th id="zip_sort" class="table-header">
                Postnr  <i class="fa fa-angle-down" style="float: right;"></i>
                <span class="hidden">sort_asc</span>
            </th>
            <th id="name_sort" class="table-header">
                Fulde navn  <i class="fa fa-angle-down" style="float: right;"></i>
                <span class="hidden">sort_asc</span>
            </th>
            <th id="email_sort" class="table-header">
                Email  <i class="fa fa-angle-down" style="float: right;"></i>
                <span class="hidden">sort_asc</span>
            </th>
            <th class="table-header">
                <i class="fa fa-ban " style="color:#ff4330"></i>
            </th>
        </tr>
    </thead>
    <tbody id="body">
        <?php
        $excel = $vars['excel'];
        for ($i = 1; $i <= count($excel); $i++): ?>
            <tr class="table_elements" style="cursor: pointer">
                <td>
                    <input type="checkbox" class="" id="<?php echo $excel[$i]['row'] ?>" />
                </td>
                <td>
                    <img src="/site/resources/images/outlook.png">
                </td>
                <td>
                    <i class="fa fa-phone"></i>
                </td>
                <td class="table_column">
                    <?php echo $excel[$i]['telephone'] ?>
                </td>
                <td class="table_column">
                    <?php echo $excel[$i]['provider'] ?>
                </td>
                <td class="table_column">
                    <?php echo $excel[$i]['zip_code'] ?>
                </td>
                <td class="table_column">
                    <?php echo $excel[$i]['first_name'] . ' ' . $excel[$i]['last_name'] ?>
                </td>
                <td class="table_column">
                    <?php echo $excel[$i]['email'] ?>
                </td>
                <td>
                    <i class="fa fa-ban " style="color:#ff4330"></i>
                </td>
            </tr>
        <?php endfor; ?>
    </tbody>
</table>
Has anyone tried something like this and know a work around / hack to solve the problem?
 
     
     
    