Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronous creation #60

Closed
rdevon opened this issue May 28, 2016 · 2 comments
Closed

Synchronous creation #60

rdevon opened this issue May 28, 2016 · 2 comments

Comments

@rdevon
Copy link

rdevon commented May 28, 2016

Small issue when loading data synchronously and forming papaya objects:

d3.json("images/data.json", function(error, data) {
    if (error) throw error;
    var images = data.images; // array of file paths (not used in this example).

    var params = {
        worldSpace: true,
        kioskMode: true,
        showControls: false,
        showImageButtons: false,
        fullScreenPadding: false
    };

    d3.select(".row").selectAll(".papaya-viewer")
        .data(images).enter()
        .append("div")
        .attr("class", "col-xs-6 col-sm-3 col-md-3 well rowCell")
        .append("div")
        .attr("class", "papaya")
        .attr("data-params", "params");

    images.forEach( function (d, i) {
        papaya.Container.resetViewer(i, params);
    });
});

When forming the papaya objects synchronously in this manner, each of the divs print out "papaya requires javascript...". (I imagine the result will be the same if jQuery ajax is used). If this is done outside of d3.json (such as using a dummy array as data), it works fine.
Is there a way around this or do the papaya objects need to be formed asynchronously?

Thanks

@rii-mango
Copy link
Owner

The "Papaya requires JavaScript..." message happens when JavaScript doesn't run for some reason. That is, the message is part of the CSS (src/css/base.css) and is removed by JavaScript (src/js/main.js#resetComponents). So if JavaScript never runs, the message just stays there.

If you can create a little working example that I can play with, I can get a better idea of what might be going on (maybe just a simplified HTML for the JS you posted).

It should be able to support synchronous and asynchronous loading -- but maybe something else is needed to support libraries like D3.

@kaurao
Copy link

kaurao commented May 17, 2019

Has this been solved?

I encountered the same issue recently.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants