Neme Zya
Neme Zya

Reputation: 45

Filter on Onsen UI lazy repeat?

Is there a way to apply a search filter on an Onsen UI lazy repeat list ?

If we use for instance <input ng-model="search.$">

We can't directly apply | filter:search as it is not an ng-repeat.

Any idea ?

Thank you.

Upvotes: 1

Views: 1655

Answers (1)

Andreas Argelius
Andreas Argelius

Reputation: 3614

You need to filter the results return by the delegate object:

Simple example:

$scope.MyDelegate = {
  configureItemScope: function(index, itemScope) {
    itemScope.name = $scope.filteredItems[index].name;
  },
  calculateItemHeight: function(index) {
    return 44;
  },
  countItems: function() {
    return $scope.filteredItems.length;
  }
};

In this codepen a large list of countries is filtered in this way: http://codepen.io/argelius/pen/VLdGxZ

Upvotes: 1

Related Questions