【问题标题】:Returning only the filtered tree from fancytree仅返回从 fancytree 过滤的树
【发布时间】:2019-07-14 23:44:06
【问题描述】:

请帮忙。

这可能很简单,但我已经坚持了好几天了。

正如标题所说,我只想获得过滤后的树,包括fancytree 中的父节点(用于json 目的)。

我看过ext-filter,但它似乎没有直接提供任何getRootNodefindAll 函数。

如何检索树的过滤版本?

【问题讨论】:

  • 你的代码在哪里?向我们展示您的尝试

标签: javascript json filter fancytree


【解决方案1】:

可以这样穿:

var nodeList = tree.toDict(false, function(d, node){

  if( !node.isMatched() && !node.subMatchCount) {
    return false;
  }
});

(注意:toDict 回调仅从 Fancytree 2.32 版开始支持返回 false。在此之前,您必须使用 tree.visit(callback)node.toDict(false) 等解决方法)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-14
    • 2021-09-17
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    • 2021-02-23
    • 1970-01-01
    相关资源
    最近更新 更多