[英]How to implement filter in strict mode in ng-grid?
I'm Using ng-grid to populate the Data. 我正在使用ng-grid填充数据。 I'm using the ng-grid internal filter.
我正在使用ng-grid内部过滤器。 But its not what i want.
但这不是我想要的。
Data is 数据是
$scope.myData = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
If I search "Moroni" I'm getting the output i needed. 如果我搜索“ Moroni”,则得到所需的输出。 But If i search "roni" ( Moroni ) I should not see Moroni name.
但是,如果我搜索“ roni” (莫罗尼),我就不会看到莫罗尼的名字。 My question is how can i apply the strict comparison of the key value.
我的问题是我如何才能对键值进行严格的比较。
I want the filter should be true only when 我希望过滤器仅在以下情况下才为真
filterText == 'Moroni'
[ exactly matching the text instead substring ] filterText == 'Moroni'
[完全匹配文本,而不是子字符串]
In the angular docs for filter: http://docs.angularjs.org/api/ng.filter:filter 在过滤器的有角度文档中: http : //docs.angularjs.org/api/ng.filter :filter
You find this under comparator
: 您可以在
comparator
下找到它:
true: A shorthand for function(actual, expected) { return angular.equals(expected, actual)}.
this is essentially strict comparison of expected and actual.
So try filter:filterText:true
因此,尝试
filter:filterText:true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.