You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a create_chart() method and it works when I trigger it via unicorn:click from a button HTML element. However, when I trigger the same function from a parent component the js does not get triggered. Everything else works, the elements are correctly created, but the self.call() does not trigger the js.
classPageView(UnicornView):
status=""updated_status=Falsedata= {}
defget_data(self, reel_code: str=""):
signal_name="ttd"con=sqlite3.connect("signals_lamination.sqlite")
df=pandas.read_sql(
f"""select * from signals_lamination where signal_name='{signal_name}' and stack_id <> '#N/D' and reelcode_anode='{reel_code}' """,
con=con,
)
self.data=dfforchildinself.children:
ifhasattr(child, "chart_data"):
child.chart_data=dfchild.create_chart()
classChartView(UnicornView):
chart_data= {}
chart=Nonechart_clicked=Falsedefmount(self):
print("testing chartview")
ifisinstance(self.chart_data, pandas.DataFrame):
self.create_chart()
defcreate_chart(self):
chart=cpk_chart(
self.chart_data,
measurement_name="signal_value",
lsl=104.45,
tg=105,
usl=105.7,
)
chart.save("chart.json")
withopen("chart.json", "r") asf:
chart=json.load(f)
self.chart_clicked=Trueself.chart=chartself.call("createChart", self.chart) #<-- this works if trigger the function with unicorn:clickreturnchart
The text was updated successfully, but these errors were encountered:
Hmm, I don't think I've ever tried using self.call from within a child component. Can you create a PR with the smallest possible test case to replicate this in the example project? That way I can easily make sure that whatever fix I come up with will work. Thanks!
I have refactored the code in one component and it works, but of course we need to check it. I will send you a PR these days, trying to replicate the issue with the simplest code.
I have a
create_chart()
method and it works when I trigger it viaunicorn:click
from abutton
HTML element. However, when I trigger the same function from a parent component the js does not get triggered. Everything else works, the elements are correctly created, but theself.call()
does not trigger the js.The text was updated successfully, but these errors were encountered: