Try our conversational search powered by Generative AI!

Blocks that are rendered by JavaScript

Vote:
 

Hi!

If you've a block that is 100% rendered by the client. For example; you've a bock that is listing news from episerver by doing a AJAX-request and then using some kind of javascript templete engine to display the data returned from the server within the block. 

This will be fine for the public visitor but there are some issues for the editor to solve:

It seems like when the block is updated by the editor in the episerver ui, a ajax request is fetching the html for the block from the server. In this case EPiServer will get the raw javascript template and display it for the editor because my code has no knowledge about that EPiServer just replace a part of the DOM.

Is there some way to intercept this behaviour, so that I can fetch the news based on the new settings from the server and bind it to the javascript template when the editor is updating the block in EPiServer ui?

Is there any kind event that is triggerd when a block has been updated by the editor?

How would you recommend to build blocks that is 100% rendered by javascript? I feels like this should be a pretty common case when building image sliders and stuff like that?

 

 

 

#76337
Oct 22, 2013 12:33
Vote:
 

You can work around this by using EditHints and AddFullRefreshFor and register that if the property is changed the whole page should be reloaded.

A better solution, that is much harder to accomplish, requires that you create your own editor in javascript. Then you have complete control of how you property is edited and rendered in javascript.

#76443
Oct 24, 2013 15:43
Vote:
 

Thanks for the tip Fredrik! AddFullRefreshFor solves this. Creating a custom editor sounds cool! Unfortunately not possible within the timeframe of this project :( But it would be a great open source project!

#76470
Oct 25, 2013 8:39
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.