-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUG] on_change events of DataTable CDS fail when source is set after init #9770
Comments
@maeglin89273 your code works for me if I change to pass table = DataTable(editable=True, width=300, height=150, source=cds) It should work the way you have it too, and I am not sure why it does not, but hopefully this is an immediate solution for you. |
Thanks, @bryevdv ! I didn't aware I can set the source and columns in the constructor. It really solves my problem. |
@maeglin89273 FYI in general, every typed property on any bokeh object can always be configured via a keyword argument in the initializer. |
OK, the custom initializer on the base class is the problem: def __init__(self, **kw):
super().__init__(**kw)
if "view" not in kw:
self.view = CDSView(source=self.source) If
The last option would allow us to get rid of the initializer altogether which would be good, but make BokehJS more complicated and also add an unnecessary backward sync to server apps, which is not great. At the further end of possibilities, we could add a "finalize" protocol for making these kinds of configurations right at serialization time (similar to validations) and that might allow getting rid of most of the custom initializers. That would allow us to still have the configuration done on the Python side and that would be ideal. |
@mattpap for reference this solves the issue:
Would you be in favor of this approach to get rid of initializers on models more generally? |
Software version info
bokeh 2.0.0
chrome 80.0.3987.132 (Official Build) (64-bit)
ubuntu 19.10
Description of expected behavior and the observed behavior
Context:
Expect:
Observed:
Complete, minimal, self-contained example code that reproduces the issue
The text was updated successfully, but these errors were encountered: