Jquery 添加&;删除数据表中更多基于克隆的搜索/筛选器

Jquery 添加&;删除数据表中更多基于克隆的搜索/筛选器,jquery,datatables,Jquery,Datatables,我想添加一些按钮,在单击数据表的搜索/过滤器时创建 <button class="seachbutton" id="searchbutton_1" data-column="0" data-value="lookforthis_A"> <button class="seachbutton" id="searchbutton_2" data-column=&qu

我想添加一些按钮,在单击数据表的搜索/过滤器时创建

<button class="seachbutton" id="searchbutton_1" data-column="0" data-value="lookforthis_A">
<button class="seachbutton" id="searchbutton_2" data-column="1" data-value="lookforthis_B">
<button class="seachbutton" id="searchbutton_3" data-column="2" data-value="lookforthis_C">
如果我点击一个按钮,对点击的按钮进行过滤/搜索就可以了

现在,如果我点击第二个按钮,这个搜索应该是现有搜索的补充(在第一次点击按钮1之后)

比如说 首先单击一个按钮-查询:“Column=0&value=lookforthis_a”

单击另一个按钮-查询:“Column=0&value=lookforthis_A&Column=1&value=lookforthis_B”

我该怎么做


此外,我还必须再次单击按钮来删除搜索/过滤器-我如何才能做到这一点?

使用数组应该可以工作:
列([2,3])
。请参阅文档。对于所有列,请使用
columns.every()
,如中所示。还可以查看它们的起始点与您可能想要的一样(每个列都有自己的搜索框)。好的,我用数组进行了尝试,有没有办法从agein中删除单个搜索?@andrewjames您能给我一个简单的例子吗,如何将另一列的新搜索添加到其他列的现有搜索中?是否更改了
列(2)
列([2,3])
不起作用?也许我误解了你的意图。。。
var table = $('#example').DataTable();
 
$('.searchbutton').on( 'click', function () {
    table
        .columns( $(this).attr("data-column") )
        .search( $(this).attr("data-value"))
        .draw();
} );