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

renderOptions: you have to manually adjust "x$params$rendererOptions" for it to take effect #92

Open
ghost opened this issue Sep 24, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 24, 2018

If you pass arguments to the renderOptions param, it is necessary to manually update x$params$rendererOptions (with itself?) to get it to work. Consider this example:

MYPIVOT <- rpivotTable(
    Titanic,
    rows = "Survived",
    cols = c("Sex"),
    rendererOptions = list(table = list(
        clickCallback = htmlwidgets::JS('function(e, value, filters, pivotData) {
                                        var names = [];
                                        pivotData.forEachMatchingRecord(filters,
                                        function(record){ names.push(record.Sex); });
                                        alert(names.join(\"\\n\"));
                                        }'))),
    rendererName = "Table"
)

MYPIVOT 

Run this and click on any data cells--nothing happens.

But if you add this line after your call to rpivotTable:

MYPIVOT$x$params$rendererOptions = MYPIVOT$x$params$rendererOptions[[1]]

and view MYPIVOT again, then note how clicking on a cell shows a message. I have the same experience with setting c3 renderOptions, it is always necessary to add this line after a call to rpivotTable.

Thanks.

@ghost
Copy link
Author

ghost commented Oct 4, 2018

I just submitted a PR to fix this. 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

0 participants