Dataset onReady function not being called ever? [SOLVED]

I’m working on a page that loads the elements of the page (such as image, text, etc) from a dataset. All the code that is involved with loading from said dataset is called and executed from within the onReady function as defined by the wix editor. However, at least 70% of the time NONE of the code from onReady is called, regardless of situation it seems. When onReady fails to call, I tried having onError call a console.log command but again, nothing happened.

To be specific to the images below, projectDataset has projectDataset_ready called as the onReady command. However, when the page is refreshed, frequently NOTHING but the base elements are loaded, with onReady and onError never calling. Both functions have a console.log as the first thing done, and when the page fails no console.log is output.

Any thoughts?

You should wait first for the page to load, and then for the dataset to load. The dataset isn’t technically on the page like other elements are.

$w.onReady(function() {
    $w('#projectDataset').onReady(() => {
        //place your code here
    });
});
2 Likes

It looks like this actually fixed the issue! I really appreciate the help, I never thought to think of it that way. Thanks a million!

@austinv Glad to help!