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

Document how to use with layout.param.objects.rx #1005

Open
ahuang11 opened this issue Jan 8, 2025 · 5 comments
Open

Document how to use with layout.param.objects.rx #1005

ahuang11 opened this issue Jan 8, 2025 · 5 comments
Milestone

Comments

@ahuang11
Copy link
Contributor

ahuang11 commented Jan 8, 2025

I think the following should be documented in https://param.holoviz.org/user_guide/Reactive_Expressions.html

Instead of

self._coordinator.interface.param.objects.rx.bool().rx.not_()
    visible=self._coordinator.interface.param.objects.rx.bool().rx.not_()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'rx'

It should be:

self._coordinator.interface.param['objects'].rx.bool().rx.not_()

Because the param accessor works like a dataframe column accessors, if the parameter name clashes with an existing method the method takes precedence.

@maximlt
Copy link
Member

maximlt commented Jan 10, 2025

I'd rather suggest documenting this on this page https://param.holoviz.org/user_guide/Parameters.html. With a warning admonition letting people know that getattr will pick a method instead of a parameter when they clash and that getitem is the safer approach. Around the place where this is already partially documented.

Image

@philippjfr
Copy link
Member

I'd be fine with both, i.e. document it in Parameters and leave a short note in rx docs.

@ahuang11
Copy link
Contributor Author

ahuang11 commented Jan 10, 2025

I'd recommend both, or else it would seem rx only works with widgets and not layouts.

@maximlt
Copy link
Member

maximlt commented Jan 10, 2025

I'd recommend both, or else it would seem rx only works with widgets and not layouts.

I'm fine adding this warning in this page too but your comment makes me think it should be added to Panel too somewhere, since you're mentioning widgets and layouts. There's in fact a mention to Panel in this page so you could add the warning there, although it's towards the end.

Image

@ahuang11
Copy link
Contributor Author

When I was using it, I'd jump straight to this page for all rx knowledge, but yes having it in Panel would be nice

@maximlt maximlt added this to the v2.3.0 milestone Feb 13, 2025
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

3 participants