Angular JS智能表过滤集合 [英] Angular JS Smart Table Filtered collection
本文介绍了Angular JS智能表过滤集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
智能表中经过过滤的值之后的经过过滤的集合在哪里.
Where is the filtered collection after filtered value in smart table.
该表与 rowCollection
绑定.
<table st-safe-src="rowCollection" st-table="displayed" class="table table-bordered">
并且我使用了搜索过滤器:
and i have used a search filter:
<input type="text" id="regionFilter" st-search="region" />
结果过滤后,我仍然看到 rowCollection
after the result are filtered i still see all records in rowCollection
推荐答案
您可以创建指令来访问获取过滤后的Collection.例如:
You can create a directive to access the get the filtered Collection. For example:
HTML:
<table
st-table="displayedCollection"
st-safe-src="rowCollection"
on-filter="onFilter">
Javascript:
//
// Create a directive
//
angular.module("smart-table").directive('onFilter', function () {
return {
require: '^stTable',
scope: {
onFilter: '='
},
link: function (scope, element, attr, ctrl) {
scope.$watch(function () {
return ctrl.tableState().search;
}, function (newValue, oldValue) {
scope.onFilter(ctrl);
}, true);
}
};
});
//
// In your controller
//
$scope.onFilter = function (stCtrl) {
var filtered = stCtrl.getFilteredCollection();
}
这篇关于Angular JS智能表过滤集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文