Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing an object variable into :ds-filter-fields #125

Open
keithjohnsdev opened this issue Aug 29, 2023 · 2 comments
Open

passing an object variable into :ds-filter-fields #125

keithjohnsdev opened this issue Aug 29, 2023 · 2 comments
Labels
question Further information is requested

Comments

@keithjohnsdev
Copy link

Hi @kouts,

Let me start by saying I've been enjoying vue-dataset very much! You've done a great job here, so please read this as more of a question than a complaint.

I'm trying to add custom filtering to a dataset table, by building a "filterObject" object and then passing that as the value of the ds-filter-fields prop:

let filterObject = { id: 115 }
:ds-filter-fields="filterObject"

But it doesn't seem to be working. It works correctly when I explicitly define the object inline:

:ds-filter-fields="{ id: 115 }"

I've tried it as a ref:

let filterObject = ref({ id: 115 })
:ds-filter-fields="filterObject.value"

I've also tried as a reactive object to no success, but I haven't tried as a computed variable.

Is there a way to make it work by passing an object variable? Is there something I'm missing?

Thanks for any help!

@keithjohnsdev
Copy link
Author

keithjohnsdev commented Aug 30, 2023

perhaps it's not automatically updating/re-rendering the table?

edit: upon further testing, this seems to be the case. The filter gets applied and the filtered data table shows correctly if I hit sort, forcing it to update. How can this be achieved without leveraging the sort functionality?

final edit: I found a workaround. Once I put the filters as a field in the reactive state object that also contained the data, it appears to render on change now. Let me know if I should delete this issue if it's not relevant anymore. Thank you again!

@kouts
Copy link
Owner

kouts commented Aug 30, 2023

@kouts kouts added the question Further information is requested label Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants