mercredi 28 novembre 2018

Wildcard search for checkbox values don't work

for the checkbox value filter on this site https://www.test-site.ch/stackoverflow-sprachen.html I would like the user to find the value "Deutsch" in column1 not only if "Deutsch" is a single value, but also if "Deutsch" is part of the entire cell value.

Currently the check on "Deutsch" only shows 1 row, but 2 are actually expected.

this is the function embedded in the header section:

<script type="text/javascript" class="init">
$(function() {
  otable = $('#dt').dataTable();
})
function filterme() {
  //build a regex filter string with an or(|) 
condition
var types =$('input:checkbox[name="type"]
:checked').map(function() {
return '^' + this.value + '\$';
}).get().join('|');
//filter in column 0, with an regex, no smart 
filtering, no inputbox,not case sensitive
otable.fnFilter(types, 0, true, false, false, 
false);
}
</script>

Table content

<tbody>
  <tr>
  <td>Deutsch</td>
  <td>8156</td>
  <td>Dielsdorf</td>
  <td>Hans Muster</td>
  <td>Sekundarlehrer (pensioniert),
      4 Jahre Erfahrung</td>
   <td>30.--</td>
  </tr>
  <tr>
    <td>Italienisch Franz&ouml;sisch Deutsch </td>
    <td>8000</td>
    <td>Z&uuml;rich</td>
         <td>H. W&auml;ckerli </td>
              <td>Gymi Lehrer </td>
              <td>30.--</td>
  </tr>




Aucun commentaire:

Enregistrer un commentaire