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

Can't get $options in autocomplete, and can't override query_builder in base class #1613

Closed
robert-hoffmann opened this issue Mar 12, 2024 · 4 comments

Comments

@robert-hoffmann
Copy link

robert-hoffmann commented Mar 12, 2024

I need to access a variable i passed in in the component

I add the variable here
image

Then i pass it on here
image

And pass it along again here
image

But no matter what i do, i can't seem to access $options here inside the query_builder
And i need to to customize the query_builder code to filter stuff based on that variable
image

Also i can't override query_builder here in the base class (it's just ignored), or i would have done it here
(yet you "can" override other settings)
image

Any ideas ?

@smnandre
Copy link
Member

In the documentation, there is a note just before this

Avoid passing any options to the 3rd argument of the ->add() method as these won't be used during the Ajax call to fetch results. Instead, include all options inside the custom class (FoodAutocompleteField).

If i understand it right, you fall in this case. But there is a new way to pass options to query, look #1322

@robert-hoffmann
Copy link
Author

robert-hoffmann commented Mar 13, 2024

Interesting 👍

But i still don't see how i can extract extra_options inside
image

I need to access it inside query_builder

@robert-hoffmann
Copy link
Author

robert-hoffmann commented Mar 13, 2024

Ok i got it like this ..probably a better way to do it though
(ignore the query ..it's bugged still ^^)

image

Thanks 🙏

@robert-hoffmann
Copy link
Author

Assez moche la solution, mais ca marche
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants