I am trying to execute some custom code after a knockout template has fully rendered.
The template is Magento_Catalog/list/listing.html
The relevant part of the template for this problem is:
<div css="'products-' + displayMode">
<ol class="product-items product-slider recently-viewed" afterRender="function (t) {addSlider(t);}">
<li class="product-item" repeat="foreach: filteredRows, item: '$row'">
<div class="product-item-info">
<fastForEach args="data: getRegion('general-area'), as: '$col'" >
<render args="$col.getBody()"/>
</fastForEach>
</div>
</li>
</ol>
</div>
As you can see I added an afterRender function to the ol tag.
The items are added to the list via repeat="foreach:"
The problem now is, that whenever there is more than one li in the list the afterRender event fires only once, after the first item is being added.
So my custom code doesn't manipulate the full list like it's supposed to.
How can I execute the code after all items have been added to the list?