Salve a tutti,
vorrei eseguire una ricerca nelle righe di una tabella tramite una funzione javascript,
visualizzando la riga o non visualizzandola della tabella, a seconda se è presente una certa stringa:
function filterContacts(term, _id, cellNr){
var s = term.value.toLowerCase();
var table = document.getElementById(_id);
var ele;
for (var r = 0; r < table.rows.length; r++){
ele = null;
if (table.rows[r] != null && table.rows[r].cells[cellNr] != null){
ele = table.rows[r].cells[cellNr].innerHTML;
if (ele.toLowerCase().indexOf(s)<0 ) {
table.rows[r].style.display = 'none';
} else {
table.rows[r].style.display = 'block';
}
}
}
}
</script>
dove l'id è
<tbody id="sabc" >
e segue la tabella
contenente più
<tr>.
<td>
<div class="nowrap">.....</div>
</td>
<td>
<div class="nowrap">.....</div>
</td>
</tr>
La funzione lavora benissimo in IE,
ma mi da vari problemi in firefox,
non nascondendo correttamente le linee,
presentandomi molte linee vuote.
Qualcuno conosce qualche problema a riguardo in firefox?
e qualche workaround?
grazie mille per ogni suggerimento!
fabio