-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
add hooks for component classes #464
Comments
Great yes this could be a way to add direct Dataframe parsing support to plotly/dash-table |
I refactored the component generation, now every prop will have a descriptor that fires a prop change event (for the backend code only). The returned value from the handler will be the actual value used by the component. Example dataframe serialization: def on_prop_change(component, prop_name, old_value, new_value, prop_type):
if isinstance(new_value, pd.DataFrame):
return new_value.to_dict('records')
return new_value Two options for the prop changes events: Generate the PROS:
CONS:
Add handlers to global object (ComponentRegistry) PROS:
CONS:
I favor the second option. |
The generated components gets overwritten every time we run the generation. We can't add python code to them because of that. It would be useful if we could add code that could modify the props before sending it to the front-end.
Solution proposal:
_ComponentClass.py
file that gets overwritten.ComponentClass.py
only if it doesn't exist, it import_ComponentClass
and subclass it.The text was updated successfully, but these errors were encountered: