Итак, я пытался настроить JQuery Datatable, как в этом примере: http://plnkr.co/edit/b8cLVaVlbNKOQhDwI2mw?p=preview
Но я продолжаю получать всплывающее окно «Не найдено подходящих записей», когда я пытаюсь его реализовать. Как бы я мог это исправить?
Вот мой JS-скрипт:
$(function() {
otable = $('#amdta').dataTable();
})
function filterme() {
//build a regex filter string with an or(|) condition
var types = $('input:checkbox[name="item"]:checked').map(function() {
return '^' + this.value + '\$';
}).get().join('|');
//filter in column 0, with an regex, no smart filtering, no inputbox,not case sensitive
otable.fnFilter(types, 1, true, false, false, false);
//build a filter string with an or(|) condition
var frees = $('input:checkbox[name="website"]:checked').map(function() {
return this.value;
}).get().join('|');
//now filter in column 2, with no regex, no smart filtering, no inputbox,not case sensitive
otable.fnFilter(frees, 2, false, false, false, false);
Вот мой HTML
<p>
<label>
<input onchange="filterme()" type="checkbox" name="website" class="filled-in" value="canadacomputers" />
<span>Canada Computers</span>
</label>
<label>
<input onchange="filterme()" type="checkbox" name="item" class="filled-in" value="$2299.0" />
<span>Item</span>
</label>
</p>
<input type="text" id="amdin" onkeyup="amdfun()" placeholder="Search for CPU..">
<table id="amdta">
<thead>
<tr>
<th class="th-sm">Item</th>
<th class="th-sm">Price</th>
<th class="th-sm">Website</th>
</tr>
</thead>
{% for item in items %}
{% if item.brand == 'amd' %}
<tbody>
<tr>
<td>{{ item.item }}</td>
<td>${{ item.price }}</td>
<td>
<a href="{{ item.website }}">{{ item.site }}</a>
</td>
</tr>
</tbody>
{% endif %}
{% endfor %}
</table>