omar jandali
omar jandali

Reputation: 87

knockout.js utils.arrayFilter property is not working correctly

Hi guys I am trying to add a filter system to a project that allows users to filter a set of locations based on what they type in an input field and whatis happening is that it is auto filling with 5 sets of objects and also what ever the user inputs, doesnt really do anything and that code i got what from the website.

self.pointsFilter = ko.computed(function(){
    return ko.utils.arrayFilter(self.pointsList(), function(pointItem){
      return pointItem.done = true;
    })
  })

Upvotes: 0

Views: 49

Answers (1)

Tsvetomir Nikolov
Tsvetomir Nikolov

Reputation: 394

The expression "return pointItem.done = true;" is wrong. If you want to get only done points you have to use the == operator. And double check whether pointItem.done is not observable. If it is you should add brackets "pointItem.done()" to get the value.

Upvotes: 2

Related Questions