Issue #3199💬 AnsweredOpened December 19, 2020by mohd74690 reactions

Block render function not trigger

Quick answerby artf

The block manager doesn't see the change if you do this block.attributes.render = .... You have to update the property explicitly in this way: And be careful, the render function SHOULD return the HTML string or the DOM node, NOT a Promise. If you need to do something async, at first resolve it, THEN update the render...

Read full answer below ↓

Question

@artf - In the documentation, it says that If we need to customize the aspect of each block preview we can pass a render callback function in the block. But here is the actual thing Basically, I wrapped this render callback in a function named func() and calling it on some ajax request If I call this on page load it works but if I try to call this func() function after page load on some click event/handler or API response this render callback inside that function doesn't trigger

Answers (2)

artfDecember 30, 2020

The block manager doesn't see the change if you do this block.attributes.render = .... You have to update the property explicitly in this way: And be careful, the render function SHOULD return the HTML string or the DOM node, NOT a Promise. If you need to do something async, at first resolve it, TH...

GJSBlockMay 17, 2026

Thanks for reporting this, @mohd7469. Thanks for sharing your report about block render function not trigger. To help the team investigate and prioritize this: Please provide: A minimal reproducible example (CodeSandbox/JSFiddle) Your GrapesJS version number Browser and OS information Any error mes...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.