Print only selected records in the checkbox

0

I have the following table, but I'm not sure how to use the checkbox, how do I print only the selected checkboxes?

And as he is inside the table he is appearing in the print, how to make it not appear too.

<table class='datatable table table-hover table-bordered table-responsiv'>
        <input type="button" name="imprimir" value="Imprimir" onclick="window.print();">
       <thead>
         <tr>
            <th align='center'><font size=1>#</font></th>
            <th align='center'><font size=1>Chamado</font></th>
            <th align='center'><font size=1>Problema</font></th>
            <th align='center'><font size=1>Descricao</font></th>
            <th align='center'><font size=1>Contato</font></th>
            <th align='center'><font size=1>Data</font></th>
            <th align='center'><font size=1>Loja</font></th>
            <th align='center'><font size=1>Setor</font></th>
            <th align='center'><font size=1>Aberto</font></th>
            <th align='center'><font size=1>Status</font></th>
            <th align='center'><font size=1>Farol</th>
         </tr>
        </thead>
      <?php
         echo"<tbody>";   
         while ($row = mysql_fetch_array($query_pesquisa)) {
         echo" <tr>";
            echo '<td><input type="checkbox"></td>';
            echo"<td align='center'><font size=2>".$row['CHAMADO'].         "</font></td>";
            echo"<td align='center'><font size=2>".$row['PROBLEMA'].        "</font></td>";
            echo"<td align='center'><font size=2>".$row['DESCRICAO'].       "</font></td>";
            echo"<td align='center'><font size=2>".$row['CONTATO'].         "</font></td>";
            echo"<td align='center'><font size=2>".$row['DATA_DE_ABERTURA']."</font></td>";
            echo"<td align='center'><font size=2>".$row['UNIDADE'].         "</font></td>";
            echo"<td align='center'><font size=2>".$row['SETOR'].           "</font></td>";
            echo"<td align='center'><font size=2>".$row['ABERTO_POR'].      "</font></td>";
            echo"<td align='center'><font size=2>".$row['STATUS'].          "</font></td>";
         if($row['HORAS_EM_ABERTO'] <= 48) { 
            echo "<td><img src='verde.png'></td>"; 
         } elseif($row['HORAS_EM_ABERTO'] <= 96) { 
            echo "<td><img src='laranja.png'></td>"; 
         } elseif($row['HORAS_EM_ABERTO'] >= 97) { 
            echo "<td><img src='vermelho.png'></td>";
         } else{ 
            echo "<td><img src='vazio.png'></td>";
         };

         echo" </tr>";

       }   
      echo"  </tbody>";
     echo" </table>";

    ?>

    <script type="text/javascript"> 
            $(document).ready(function() {
                $('.datatable').dataTable({
                    "sPaginationType": "bs_full"
                }); 
                $('.datatable').each(function(){
                    var datatable = $(this);
                    // SEARCH - Add the placeholder for Search and Turn this into in-line form control
                    var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
                    search_input.attr('placeholder', 'Search');
                    search_input.addClass('form-control input-sm');
                    // LENGTH - Inline-Form control
                    var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
                    length_sel.addClass('form-control input-sm');
                });
            });

            </script>    
    
asked by anonymous 27.07.2016 / 23:49

1 answer

2

You can create a function to select all rows that are not selected, add a class, and with @media print to hide them.

Take a look at this codepen I've assembled for example: link

    
28.07.2016 / 00:10