Another thing:
If you use bind data from the database, you should know, that in preview mode it takes the data from the sandbox collection, so make sure the relevant data is in the sandbox as well.
Upon testing further I believe this is just a bug in the way Velo renders previews. It appears that it assumes that the rendering is already completed for the text fields that were rendered in the editor, and only runs the “Repeater_ItemReady(…)” events for any items not rendered in the editor.
Since the editor is limited to 12 items, and my dataset contains 17, only the last 5 “Repeater_ItemReady(…)” events run.
This is a bug. Since “Repeater_ItemReady(…)” doesn’t run in the editor, it MUST run on every line in the preview for the preview to be accurate.
You’re not doing it right.
I’m not sure what exactly you’re trying to do, but if you want the onItemReady() to run after the data gets bound via the editor connection, then you need to do something like this:
To say I’m not doing it right is incorrect. This is exactly how binding ItemReady via the editor is expected to behave in preview (as evidenced by how it behaves in live). To have it behave otherwise is a bug.
@nate See the documentation ;
“Note: When using a dataset to populate the contents of your repeated items, the onItemReady() callback function is triggered before the dataset populates the values of your page elements. Therefore, element values that you set using onItemReady() may be overridden when the dataset is ready…”
@jonatandor35 As the documentation states:
“When the data property is set for the repeater, the onItemReady function is automatically triggered.”
This is what isn’t working in the Preview. If you’re suggesting that the data property is being set while I’m still in the editor , that design doesn’t meet my expectations. That would guarantee that preview and live will behave differently from each other.
For what it’s worth, I’m perfectly happy to accept that my expectations differ from the way Velo has been designed. My expectations are that the data property will be set after I press the preview link, which would allow preview to behave like live. The current behavior doesn’t meet those expectations.