我在使用数据表的过滤功能时遇到困难。我用的是1.10版本。这是我尝试过的:
$("#hide").click(function() {
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
return $(table.row(dataIndex).node()).attr('data-user') == 5;
}
);
table.draw();
});
$("#reset").click(function() {
$.fn.dataTable.ext.search.pop();
table.draw();
});
但是表格没有更新。我可能做错了什么吗?当我执行 console.log 时,有问题的数组似乎正在更新,但没有调用该函数的迹象。
非常感谢!
最佳答案
过滤数据表。 循环遍历数据表中的所有行
$("#Datatable").html().find("xxx").hide();
or
$('#Datatable tr').each(function(index,value) {
if( $(this).find('xxx'))
{
$(this).hide();
}
});
提供重新调整功能的更多详细信息。
关于jquery - 数据表过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35934441/