you can try wrapping each item in some kind of div and load the layout on that. This way you can insert such a wrap div before the others and then load the layout to it.
something like:
B4X:
<div id="mainlist">
<div id="">
... add such a div before the others and load the new layout
</div>
<div id="">
... already loaded
</div>
<div id="">
... already loaded
</div>
</div>
you can try wrapping each item in some kind of div and load the layout on that. This way you can insert such a wrap div before the others and then load the layout to it.
something like:
B4X:
<div id="mainlist">
<div id="">
... add such a div before the others and load the new layout
</div>
<div id="">
... already loaded
</div>
<div id="">
... already loaded
</div>
</div>
Perfect, this will work well on first load. Will do it like that. Thank you so much.
Another question, when it comes to SSE and the list has to be updated after a particular event by just adding 1 item on the top without having to clear the list? what could be the best approach?
Maybe .prepend() instead of .append() is what you are looking for? You would use that to add the item 'wrap' div at the beginning of the div 'mainlist'.
Maybe .prepend() instead of .append() is what you are looking for? You would use that to add the item 'wrap' div at the beginning of the div 'mainlist'.
Just need to figure out how to move items to the top of the list based on content change, more like how whatsapp works when a new message arrives and a chat moves up.