Skip to content

Conversation

rastikw
Copy link

@rastikw rastikw commented Dec 23, 2020

I'd like to customize the chart immediately after its creation. This code could you specified during widget creation in a form of JsExpression.

@onmotion
Copy link
Owner

Hi!

I think it's not the widget responsibility to make a side js code insertion. Why don't you register $this->registerJs('') right after the widget?
Also the widget events can be useful https://www.yiiframework.com/doc/api/2.0/yii-base-widget#events

@rastikw
Copy link
Author

rastikw commented Dec 25, 2020

Hi, registering JS code right after the widget was the first idea. But you use setTimeout to create the chart, so it is not created by the time code is executed. And I don't think it is a good idea to add my code using setTimeout as well and hoping the browser will keep the proper order (which it may not in some circumstances).

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

Successfully merging this pull request may close these issues.

2 participants