我在一个问题中看到“过滤树或嵌套数据#1562”之一,Oli曾提到过
嘿@ fr0z3nfyr从版本4,2开始,树子节点上支持过滤干杯奥利:)
我无法找到任何示例或代码来搜索嵌套数据。我的代码对平面表工作正常,但对于嵌套表,它仅对根节点有效。
//data - the data for the row being filtered
//filterParams - params object passed to the filter
var match = false;
for (var key in data) {
if (data[key] != null) {
if ((data[key]).indexOf(filterParams.value) != -1) {
match = true;
}
}
}
return match;
}
function updateFilter(){
if ($("#filter-field").val() == "All Columns") {
table.setFilter(matchAny,{ value: $("#filter-value").val()});
} else {
table.setFilter($("#filter-field").val(), "like", $("#filter-value").val());
}
//var filter = $("#filter-field").val() == "All Columns" ? matchAny : $("#filter-field").val() ;
}```
Oli could you please point me to an example where Nested data filtering is supported
我能够解决此问题,但是通过使用过滤后的值重新设置表数据,并且树形结构也不会保留在过滤后的列表中。我可以通过代码上的一些更改来维护树结构,但是此平面看起来更像过滤后需要的结构。