gpt4 book ai didi

angularjs - Angular JS 智能表筛选集合

转载 作者:行者123 更新时间:2023-12-01 22:31:50 24 4
gpt4 key购买 nike

智能表中过滤值后过滤后的集合在哪里。

表格与 rowCollection 绑定(bind)。

<table st-safe-src="rowCollection" st-table="displayed" class="table table-bordered">

我使用了搜索过滤器:

<input type="text" id="regionFilter" st-search="region" />

过滤结果后,我仍然看到 rowCollection 中的所有记录

最佳答案

您可以创建一个指令来访问获取过滤后的集合。例如:

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();
}

关于angularjs - Angular JS 智能表筛选集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29194548/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com