【问题标题】:Angular tree control ---- filter the nodes of a treeAngular树控件----过滤树的节点
【发布时间】:2018-08-16 06:13:48
【问题描述】:

我正在关注链接https://wix.github.io/angular-tree-control/ 以探索角度树控件的不同功能。从文档中无法正确理解我应该为过滤器比较器和过滤器表达式提供什么值以使其工作以过滤节点。下面是代码:

<body ng-app="app">
Search: <input ng-model="searchTree">
<table id="searchTextResults">
<tr><th>Name</th><th>Age</th></tr>
<tr ng-repeat="data in dataForTheTree | filter:searchTree">
<td>{{node.name}}</td>
<td>{{node.age}}</td>
</tr>
</table>
<div ng-controller="myController">
<treecontrol class="tree-light"
tree-model="dataForTheTree"
filter-expression="data" 
filter-comparator="false"
options="treeOptions"
on-selection="showSelected(node)"
selected-node="node1">  {{node.name}} age {{node.age}}
</treecontrol>
</div>
</body>

plunkr 的完整链接:https://plnkr.co/edit/bQHOIQ2HDPr4WJaukB8I?p=preview

【问题讨论】:

  • 找到了答案。

标签: angularjs treecontrol


【解决方案1】:

在这里我们可以使用filter-expression 就像ng-repeat | filter:{} 选项

filter-expression="{filterable column: ng-model name}"

ex - filter-expression="{name: searchByName}"

我们可以使用

filter-comparator="true"
filter-comparator="false"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-28
    • 1970-01-01
    • 2013-11-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多