Item ready issue

I have a repeater and updating few items on item ready event. Few items are refreshed. But not all. For instance, say I am displaying comment and like count on each items. But count is refreshed only for first 2-3 items. Any one faced this issue? Any suggestion?

Since you are updating items in your Repeater , I suspect that the issue you are having is described in the onItemReady() API :

The callback is triggered when you add new items by setting the data property or when new items are created based on a dataset that is connected to the repeater. It is not triggered for existing items that are updated when you set the data property.

What you can do is to clear the repeater first, and then set to the updated data. Something like this:

$("#myRepeater").data = [];
$("#myRepeater").data =newRepeaterData; 

Or you can call forEachItem() after setting your Repeater to the new data.

Hi Yisrael, Thanks for your reply. I noticed some items are not refreshed as its going to catch block. Below is my code. It is working fine for firest few items. Any idea?

wixData.query( “users” ).eq( “_id” , itemData.postedBy).find().then((res) => {
if (res.items.length > 0 ) {
name.text = res.items[ 0 ].name
pic.src = res.items[ 0 ].profilePic
pic.tooltip = res.items[ 0 ].name
}
}). catch ((e)=>{
$w( ‘#eeee’ ).text=$w( ‘#eeee’ ).text+e+ "------ "
})