Jquery数据表默认过滤多列

时间:2015-02-05 01:48:23

标签: javascript jquery datatables

有什么方法可以为起始定义中的列设置默认搜索值吗?

定义默认订单或默认搜索

$('#table').dataTable({
    ajax: {url: '...'},
    order: [['0', 'asc']],
    search: { search: '...' },
    columns: [
        { data: "id" },
        { data: "name" },
        { data: "description" }
    ]
});

对于专栏"名称",我已尝试

{ data: "name", search: "initial search" }
{ data: "name", search: { search: "initial search" } }
{ data: "name", search: { value: "initial search" } }

但没有效果!

有什么建议吗?

1 个答案:

答案 0 :(得分:6)

尝试“searchCols”:用于DT的API中所述的“搜索” https://datatables.net/reference/option/searchCols