ivandoric / Theming-with-WP-REST-API

This is a repository for "Theming with WP REST API" tutorial series
http://watch-learn.com/series/theming-with-wp-rest-api/
75 stars 22 forks source link

filterPosts function multiselect #1

Open squaremunkeygist opened 8 years ago

squaremunkeygist commented 8 years ago

How would one transform the filterPosts function to work as a multiselect filter. ie using checkboxes to make multiple selections and select multiple categories? Thanks.

ivandoric commented 8 years ago

You could try just changing radio buttons to checkboxes. And then in app.js file change categoryFilter: '' to categoryFilter: [] so to make it accept an array.

squaremunkeygist commented 8 years ago

Thanks but it's not showing more then one filter. When i select two filters nothing shows. In the vue devtools the selected categories are showing up as an array but not on screen. Do i need to change something in the index for the array filter to work? thanks ivan

ivandoric commented 8 years ago

Yeah, doesn't work for me to. I think this functionallty doesn't come out of the box. You should probably write custom filter for something like that.

squaremunkeygist commented 8 years ago

I have come to the same conclusion but unfortunately my knowledge of vue.js is very limited. But how would one go about filtering posts with an array of id's. The id's are being tagged by vue.js ( see attached screenshot of vue devotees). Any thoughts are welcome. 2016-06-01 16-54-53