admin管理员组

文章数量:1129441

I developed a custom shortcode plugin in previous years which I am trying to convert to a Gutenberg block. Now that plugin renders a large number of forms including some that are calendar based, e.g. like reserving a slot at certain day and time. Because of the large number of forms, I concluded that I need dynamic server-side rendered blocks. Now such a calendar based form shows initially the possible reservation for next day, but it contains buttons to goto next or previous days. And if these are clicked, the block needs to be refreshed with the data for the selected day. So the question is, how can I force a server-side re-render of the block using the view script, thus that the php render script is called again with the new date as attribute to render the requested reservation view.

In the shortcode version, I do an ajax get call to retrieve the html content that I generate at the server. That is done for the initial render for day X as well as requested updates for day Y, Z... My idea is to replace those ajax get calls with some standard Gutenberg function that triggers the call to the ServerSideRender callback function.

本文标签: refresh dynamic block render