[英]JQuery DataTable Column Filter - select dropdown filter
At the moment, I'm trying to use a dropdown list to filter my table (I'm using Datatable plugin) 目前,我正在尝试使用一个下拉列表来过滤我的表(我正在使用Datatable插件)
This is my code : 这是我的代码:
$('#tableID').dataTable()
.columnFilter({
aoColumns: [
{ type: "text" },
{ type: "number" },
{ type: "select", values: [ 'Identify Proposal', 'Define Proposal', 'Evaluate', 'Pending Proposal', 'Approval'] },
{ type: "select", values: [ 'Identify Proposal', 'Define Proposal', 'Evaluate', 'Pending Proposal', 'Approval'] },
{ type: "text" },
null,
null,
null,
null,
null,
null,
null,
null
]
});
});
What I'm trying to do is to get my table to have a drop-down filter : http://jquery-datatables-column-filter.googlecode.com/svn/trunk/customFilters.html 我想做的是让我的表有一个下拉过滤器: http : //jquery-datatables-column-filter.googlecode.com/svn/trunk/customFilters.html
But for some reasons it's not doing what it should. 但是由于某些原因,它没有做应做的事情。 I don't know what I did wrong.
我不知道我做错了什么。 This is the link to my table : http://176.32.230.19/caffeine-cranked.com/Files/test.html
这是到我的桌子的链接: http : //176.32.230.19/caffeine-cranked.com/Files/test.html
Maybe you've to add a type of filter for each column (13 in total). 也许您必须为每列添加一种过滤器(总计13个)。 Something like this:
像这样:
var path = "lib/test.csv" ;
d3.text(path, function (datasetText) {
var rows = d3.csv.parseRows(datasetText);
var tbl = d3.select("#container")
.append("table")
.attr("id","tableID");
// headers
tbl.append("thead").append("tr")
.selectAll("th")
.data(rows[0])
.enter().append("th")
.text(function(d) {
return d;
});
// data
tbl.append("tbody")
.selectAll("tr").data(rows.slice(1))
.enter().append("tr")
.selectAll("td")
.data(function(d){return d;})
.enter().append("td")
.text(function(d){return d;})
});
$('#tableID').dataTable().columnFilter({
sPlaceHolder: "head:before",
aoColumns: [
{ type: "text" },
{ type: "number" },
{ type: "select", values: [ 'Identify Proposal', 'Define Proposal', 'Evaluate', 'Pending Proposal', 'Approval'] },
{ type: "select", values: [ 'Identify Proposal', 'Define Proposal', 'Evaluate', 'Pending Proposal', 'Approval'] },
{ type: "text" },
null,
null,
null,
null,
null,
null,
null,
null
]
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.