Good evening,
I'm having a problem in version 2.1.0 of Knockout Js with the ko foreach binding inside of containerless control flow syntax, when specifying afterRender, same setup as the OP.
Problem is, the afterRender is called for each item in the list.
I was hoping to have it called one time after the whole list has been processed.
I need to tell jQuery Mobile to re-render it's styles on the containing UL list which has a header item which is not KO bound.
I run into problems if I tell jQuery Mobile to re-render during the afterRender call currently specified in the ko foreach comment as the OP has it.
That is because if the list contains multiple items, I tell jQuery to style it in item 1's callback,
then Knockout tries to add item 2 and jQuery has modified the DOM. Knockout gets lost because the DOM is not as expected.
Solution would be for the afterRender to only fire after the whole foreach is finished.
If I wanted it to callback during every iteration I could bind to the afterRender on one of my li elements inside the foreach.
Thanks!
H