有什么方法可以为起始定义中的列设置默认搜索值吗?
定义默认订单或默认搜索
$('#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" } }
但没有效果!
有什么建议吗?
答案 0 :(得分:6)
尝试“searchCols”:用于DT的API中所述的“搜索” https://datatables.net/reference/option/searchCols