kouts / vue-dataset

A set of Vue.js components to display datasets (lists) with filtering, paging, and sorting capabilities!
https://next--vue-dataset-demo.netlify.app/
MIT License
220 stars 26 forks source link

custom filtering: array of values instead of one specific value for a field? #114

Closed mg1075 closed 1 year ago

mg1075 commented 1 year ago

I've tried to look for examples in documentation and past issues about filtering, but have been unable to find a solution to the challenge of using an array of values for one field as a filter. The examples, whether they use the standard filtering mechanism, or whether they pass a custom filterFields function to :ds-filter-fields all appear to pass one value to one field; e.g., { "active": true } or { "color": "green" }. But what about the case where you want to filter on more than one value of one field, such as { "color": ["green", "blue", "orange"] }, or passing as [{ "color": "green" }, { "color": "blue" }, { "color": "orange" }]? Is it possible to filter data in this type of scenario?

mg1075 commented 1 year ago

So I take that back. Well, sort of. The documentation example of startsWithD shows how each value of the field can be passed to a function that tests for the truthiness of a condition, and records that pass as true become part of the result set. (For me it seems a very non-intuitive approach.) https://next--vue-dataset-demo.netlify.app/components/#props