【发布时间】:2014-06-06 13:28:55
【问题描述】:
我正在使用jquery datatable 在应用程序中显示报告。使用数据表提供的默认搜索。搜索适用于大多数场景。但我在搜索某些单词时遇到了问题。
发现<td> 标签之间的内容被视为文本。因此,如果我搜索单词 add,则会显示所有行。这是因为第一列将工作 add 作为类属性。 href、get、id、progress 等也是如此。
<tr class="odd">
<td class=""><a href="#" class="add" onclick="getById(68)">68</a></td>
<td class="">friw678</td>
<td class="">windows</td>
<td class="">
<span title="Bangalore">Bangal..</span>
<p>Bangalore</p>
</td>
<td class=" sorting_1">
<span title="6/6/2014 1:02:52 PM">6/6/2014 1..</span>
<p>6/6/2014 1:02:52 PM</p>
</td>
<td class="">
<div class="progressBarBlueComplete ui-progressbar ui-widget ui-widget-content ui-corner-all" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100">
<div class="ui-progressbar-value ui-widget-header ui-corner-left ui-corner-right" style="display: block; width: 100%;"></div>
</div>
</td>
<td class="">
<span title="COMPLETED">COMPLE..</span>
<p>COMPLETED</p>
</td>
<td class="">sha5</td>
</tr>
有没有办法只考虑内部标签内的文本。 (而不是考虑内部标签。)这样如果搜索单词href搜索结果为空。
使用的数据表是https://datatables.net/
【问题讨论】:
标签: javascript jquery html datatable