如何通过下拉值过滤NG-网格 [英] How to filter the NG-Grid by dropdown values
本文介绍了如何通过下拉值过滤NG-网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个下拉菜单,获取从Nggrid柱填充。下拉是一个独立的控制。
I have a drop down menu which get populated from Nggrid Column. The dropdown is a separate control.
我想根据从下拉值选择的值过滤NG-电网。我该怎么做呢?
I want to filter the NG-grid based on the value selected from drop down value. How do I do this?
推荐答案
您可以在NG-更改添加到您的选择是这样的:
you could add an ng-change to your select like this:
select(ng-model="search", ng-options="data in datas", ng-change='myfilter()')
和在你的控制器:
$scope.myfilter = function() {
$scope.datas = $filter('filter')($scope.datas, {data.YourField: $scope.search});
// or:
// $scope.datas = $scope.datas.filter(function(data) {
// return data.YourField == search || data.YourOther == search;
// }
};
这篇关于如何通过下拉值过滤NG-网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文