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