Is there any method to render a certain partial after page load?
I have the following code:
<div class="row document_display custom_scrollbar">
<div class="col-10">
<div class="row">
{{> document_whiteBox column="6" public_source="true" title="Título do Documento" author="João Dezembro" data="10 de maio de 2018" content="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad runt mollit anim id est laborum."}}
</div>
</div>
</div>
There is the partial document_whiteBox that receives some aruments. This document loads dynamically, that is, the more I scroll, the more documents it loads (like the facebook feed)
I would like to retrieve the server information via API and render this document_whiteBox during the scroll.
It’s possible?
2
Answers
I was able to solve it like this:
I render a template without any content with the display: none when I retrieve the content, I use JQUERY to create an element based on this hidden template
Hidden div with templates
Code to generate an element based on a template:
I’m afraid that’s not possible. Your template processing is over then.
What you can do is to put an even on scroll that will display the next event by reexecuting the code on the right data.
Otherwise another solution (but more costly) is to return all data to the client and hide the parts until the user scrolls.