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

:ds-search-in="['customer.xxxx']" nested object #107

Closed grabelle closed 1 year ago

grabelle commented 1 year ago

Hi, I have a ds-data like [ { reference:'ref1', customer:{ name:'my name1', code:'my code1'} }, reference:'ref2', customer:{ name:'my name2', code:'my code2'} } ]

I added :ds-search-in="['customer.code']" but it doesn't work i search for 'My code2' Where am I wrong ?

Thanks a lot for your help Guillaume

kouts commented 1 year ago

Hello, @grabelle currently searching through nested objects is not supported.

kouts commented 1 year ago

Hello @grabelle, although searching in nested objects is not supported by default, you can achieve what you want by customizing the search function for the field you want to search (in your case customer) using the search-as prop. Check this Stackblitz example in which you can search the favoriteColor attribute inside the extra attribute of the data objects. https://stackblitz.com/edit/vue-sxre9l?file=src/App.vue

Type e.g green or orange in the search input to see it working (it searches for an exact match inside extra.favoriteColor).

clabnet commented 6 months ago

Hello @grabelle , I have the same problem. The stackblitz example It seems not working.
Have you a suggestion for me ? I still using Vue 3 with next branch.