Javascript 数据属性上的数据表搜索

Javascript 数据属性上的数据表搜索,javascript,jquery,datatables,datatables-1.10,Javascript,Jquery,Datatables,Datatables 1.10,为我构建的datatable使用此html和js代码 <button class="test">test</button> <table id="example2" class="display table " width="100%"> <thead> <tr> <th>Code</th> <th>Email</th>

为我构建的datatable使用此html和js代码

<button class="test">test</button>
<table id="example2" class="display table " width="100%">
    <thead>
        <tr>
            <th>Code</th>
            <th>Email</th>
            <th>Status</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>abc12345</td>
            <td data-search="derrick1@gmail.com"><input name="email[]" id="row-email-0" value="derrick1@gmail.com"  /></td>
            <td>N/A</td>
        </tr>
    </tbody>
</table>

<script>
var theTable = $('#example2').DataTable({
                    "ordering": false
                });

theTable.row.add([
    'abc432',
    '<input name="email[]" id="row-email-\' + rowIndex + \'" value="" />',
    'N/A'
]).draw(false)
</script>
测试
代码
电子邮件
地位
abc12345
不适用
变量theTable=$('#示例2')。数据表({
“排序”:错误
});
theTable.row.add([
“abc432”,
'',
“不适用”
]).抽签(假)
如何在datatable的row.add方法上设置数据搜索属性?

请参见此->…您可以通过以下方式包括
数据搜索属性:

theTable.row.add({
    0 : 'abc432',
    1: {
      display: '<input name="email[]" id="row-email-\' + rowIndex + \'" value="" />',
      '@data-search': 'something'
    },
    2 : 'N/A'
}).draw(false)
theTable.row.add({
0:'abc432',
1: {
显示:“”,
“@data search”:“某物”
},
2:‘不适用’
}).抽签(假)

用您的代码演示->

请澄清您的问题。是否要使用自定义搜索输入向现有表中添加行?搜索栏随零配置一起提供:Hi@Twisty,我需要通过datatable row.add方法对电子邮件列进行数据搜索,电子邮件列与输入字段相关。如果未设置数据搜索,默认情况下,搜索栏无法搜索电子邮件列。