GrahamTheDev
GrahamTheDev

Reputation: 24885

knockout multiple filter options

I am stuck with knockout on array filters / how to filter an array with multiple options.

What I am attempting to do is find the correct item from 'matrix' where type == "nono" and data -> beds == 1.

I can easily filter by type == "nono" but I am stuck on how to get items within data.

I hope the fiddle shows what I am attempting to do, but if you need any clarification then let me know.

e.g. I want it to return { id: 1, beds: 1, baths: 1, priceLow: 1564, priceHigh: 1930 }

Link to JS Fiddle

Upvotes: 0

Views: 120

Answers (1)

Dandy
Dandy

Reputation: 2177

You can forEach your nested data object and build an array if data.beds==1.

Example fiddle http://jsfiddle.net/newuserjs/R8dpQ/196/

Upvotes: 3

Related Questions