admin管理员组文章数量:1122832
I try to pre-filter my collection of objects to be displayed in a smart-table. I don't want to make a filtered copy of the table in my controller because of the memory usage. The filter convert the row Id to number and check if it is greter than 0:
app.controller("MyCtrl", ['$scope', '$http', '$sce', function ($scope, $http, $sce) {
app.sources = []; // Loaded dynamically
app.filterIdGTZ = function (rowobj) {
return Number(rowobj.id) > 0;
}
}
I tried to filter the st-table without success:
<table st-table="displayedSources | filter: app.filterIdGTZ" st-safe-src="app.sources" class="table table-striped align-middle">
I also tried to filter the st-safe-src:
<table st-table="displayedSources" st-safe-src="app.sources | filter: app.filterIdGTZ" class="table table-striped align-middle">
I also tried to filter at the level, but that break the client side pagination by displaying less rows that requested:
<tr ng-repeat="source in displayedSources | filter: app.filterIdGTZ">
Do I have no other choice than copy a filtered version of my table? But then I will have a hell lot of other problems as i will have to update the original table when the filtered copy will be updated...
本文标签: filterprefiltering my rows in Angularjs with smarttablesStack Overflow
版权声明:本文标题:filter - pre-filtering my rows in Angularjs with smart-tables - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736311341a1934702.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论