DataTable正确隐藏行

时间:2015-08-28 23:35:49

标签: javascript jquery datatable row

我对javascript有很多经验,我有一个很大的问题需要解决。

如何正确隐藏某些行线?

当这条线被隐藏在桌面上时,我喜欢它只有可见线“重置”,通常显示分页和可见线。

var tableList = $('#listaJogadores').DataTable();
var tabela = document.getElementById('listaJogadores');

$(document).on("click",".searchButton" ,function(){

  for (var i = 1; i < tabela.rows.length; i++) {
     var divPosicao = tabela.rows[i].cells[1].getElementsByTagName('div')[0].innerHTML;
     var divIdJogador = tabela.rows[i].cells[1].getElementsByTagName('div')[1].innerHTML;

      if (divPosicao != posicaoLista){
        tabela.rows[i].style.display = 'none';
      }
   }
});

Problem image here

1 个答案:

答案 0 :(得分:0)

START TRANSACTION; DELETE FROM t1 WHERE Col2 = 2 AND Col1 <> "b"; -- Without checking Col1 the row will be replaced instead of updated if the entry ("b",2) already exists INSERT INTO t1 (Col1, Col2) VALUES("b",2) ON DUPLICATE KEY UPDATE Col2 = VALUES(Col2); COMMIT; 中添加行内容,然后隐藏div