Component "first render" event
Question
Hi. I'm developing a plugin for charts using chart.js. I need to persist the model of the chart inside the generated component to render the chart on back canvas loads. In order to achieve this, I decided to persist the model of the chart in an HTML atribute of the component. This is the generated HTML of the component after I configure the chart (the model of the chart is stored in the attribute "chartmodel"): My strategy is, when the component is first rendered, if there is a chart model (inside the "chartmodel" attribute of the component), then the chart is rendered parsing the JSON string...
Answers (3)
You can use onRender
Thanks, this method works! However, I have to store the model of the chart inside the html of the component, in order to make possible that the generated template render the chart outside the grapesjs editor. I can't persist anything inside a custom html attribute of the component, the way I want:...
@gabrigcl I don't understand which is the problem now... I can't persist anything inside a custom html attribute of the component, the way I want But it's exactly what you've showed in your previous post, try elaborate better what you need and what you're not able to achieve, a live demo would be b...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1459
How to store "data-" attributes into the html tag of the component
Hi, I'm developing a plugin for charts using chart.js. In order to the generated template render the chart from a data model generated by t...
Issue #1355
Component resize event
I have a canvas component and I need to be able to register resize events for it. After diving trough the code and looking for relevant mod...
Issue #1888
Add custom html inside canvas
Hi there, I'm using grapes to export a custom json with all the information i need, instead of HTML and CSS. For doing that I'm parsing the...
Issue #1255
How to set editor html contents from custom component?
I'm having trouble getting a custom block+component to display its template HTML inside the grapes editor. Within the exported HTML, the ma...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.