【发布时间】:2015-07-07 06:01:25
【问题描述】:
我的数据表版本是 1.10.4。 我通过传递 Javascript 源数据来填充数据表
var dataSet = [
['Trident', 'Internet Explorer 4.0', 'Win 95+', '4', 'X'],
['Trident', 'Internet Explorer 5.0', 'Win 95+', '5', 'C']
//----
];
$(document).ready(function () {
$('#demo').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>');
$('#example').dataTable({
"data": dataSet,
"columns": [
{ "title": "Engine" },
{ "title": "Browser" },
{ "title": "Platform" },
{ "title": "Version", "class": "center" },
{ "title": "Grade", "class": "center" }
]
});
});
现在我有一个搜索输入来根据输入过滤表格。 我正在尝试获取返回并在表中呈现的过滤数据。
例如,如果用户搜索输入是“C”,那么我应该得到过滤后的数据
var 数据集 = [ ['Trident','Internet Explorer 5.0','Win 95+','5','C'] ];
是否有任何标准方法可以在数据表中获取过滤后的数据?
如果不是,我想在键上获取数组
$( "#searchInput").on( 'keyup change', function () {
// get the filtered JavaScript data
});
【问题讨论】:
标签: javascript jquery datatable datatables