数据表+每列添加一个过滤器

时间:2015-10-20 02:29:41

标签: filter datatables

如何让搜索/过滤器按列工作?

我正在构建一个小步骤,并不断添加到我的数据表,这在这个阶段是非常动态的。它基本上根据输入的数据构建数据表。我现在已经添加了页脚作为搜索/过滤器,但不幸的是,这是我陷入困境的地方。我无法让文件管理器部分工作。建议非常感谢。

这是我正在处理http://live.datatables.net/qociwesi/2/edit

的示例数据表

它基本上有按表构建的dTableControl对象。

要构建我的表,我需要调用loadDataFromSocket,它执行以下操作:

//then I have this function for loading my data and creating my tables
//file is an array of objects
//formatFunc is a function that formats the data in the data table, and is stored in options for passing to the dTableControl for formatting the datatable - not using this in this example
//ch gets the keys from file[0] which will be the channel headers
//then I add the headers
//then I add the footers
//then I create the table
//then i build the rows using the correct values from file
//then I draw and this then draws all the row that were built
//now the tricky part of applying the search to each columns

所以我有这么远,但每列的搜索不起作用。如何让每列的搜索/过滤器变为wrok?

请注意,这是我一直在努力的一个非常基本的工作示例:http://jsfiddle.net/HattrickNZ/t12w3a65/

1 个答案:

答案 0 :(得分:0)

您应该使用t1.oTable访问DataTables API,请参阅updated example进行演示。

请在您的问题中将您的代码与jsFiddle进行比较,注意其简单性并考虑重写您的代码。

相关问题