单击选项卡的任何类别(选项卡)时,dataTable应删除其他类别数据。我按照这个例子 - http://jsfiddle.net/d5hre2ux/,但是系统给出了“TypeError:undefined不是一个对象(评估'$ .fn.dataTable.ext')”错误。
这是我的代码。
<script src="https://code.jquery.com/jquery-1.9.1.min.js" integrity="sha256-wS9gmOZBqsqWxgIVgA8Y9WcQOa7PgSIX+rPA0VL2rbQ=" crossorigin="anonymous"></script>
<script type="text/javascript" src="{% static 'js/jquery.dataTables.min.js' %}"></script>
<script>
$('#alldataTable').DataTable({
});
var table1 = $('#alldataTable').DataTable();
$("#Tabs").click(function(event){
$.fn.DataTable.ext.search.push(
function(settings, data, dataIndex) {
var id = event.target.id;
return $(table1.row(dataIndex).node()).attr('data-user') == id;
}
);
table1.draw();
});
$('#alldataTable tbody').on('click', 'tr', function () {
var data = table1.row( this ).data();
window.location.href = "about"
});