-
Notifications
You must be signed in to change notification settings - Fork 147
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
rhot x Shiny: params is null #198
Comments
Workaround for determing
|
Having a same issue. Please let me know if anyone has found a solution to load the params imported from R to the rhandsontable within Shiny. |
I just checked with version 0.3.6 and it seems that an R provided params cannot be accessed with rhandsontable in a shiny app. This code for row highlighting used to work fine for highlighting a user-specified row:
However, even when installing older versions of rhandsontable this code no longer seems to work, so maybe the error is somewhere else. |
Please take a look at the Custom Renderer using an R Parameter section at
http://jrowen.github.io/rhandsontable/#custom_renderer. There's definitely
an opportunity to improve this functionality.
…On Mon, Jan 29, 2018, 8:20 AM Bernhard Klingenberg ***@***.***> wrote:
I just checked with version 0.3.6 and it seems that an R provided params
cannot be accessed with rhandsontable in a shiny app. This code for row
highlighting used to work fine for highlighting a user-specified row:
DF <- data.frame(val = 1:20, bool = TRUE, nm = LETTERS[1:20],
dt = seq(from = Sys.Date(), by = "days", length.out = 20),
stringsAsFactors = F)
app <- shinyApp(
ui = fluidPage(
numericInput("myindex", "Highlight Row:", value=1, min = 1, max = 20),
rHandsontableOutput("hot", height=200, width = 300)
),
server = function(input, output) {
output$hot <- renderRHandsontable({
myindex <- input$myindex - 1
rhandsontable(DF, myindex = myindex) %>%
hot_cols(renderer = "function(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
if (instance.params) {
mhrows = instance.params.myindex;
mhrows = mhrows instanceof Array ? mhrows : [mhrows];
}
if (instance.params && mhrows.includes(row)) td.style.background = 'lightblue';
"
)
})
}
)
runApp(app)
However, even when installing older versions of rhandsontable this code no
longer seems to work, so maybe the error is somewhere else.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#198 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABdYrujeA7wWbfHfn0Zf-qUKWkgolcsLks5tPdOXgaJpZM4P0K7M>
.
|
Sorry, my code above was missing a
This should result in something like this: |
It looks like this is resolved, but please re-open if it's still an issue. |
Hi there,
I'm encountering an issue when trying to implement a custom renderer as mentioned here. I'm creating a rhot inside
renderRHandsontable
in which based on a value selectedinput$routeID
the rows containing the selected value should be highlighted.The code I have is this:
Running this w/o the call to
hot_cols()
works just fine but with it no table is shown. Using my browser's console I was able to trace it to the fact that I am indeed able to assigntbl
to the corret table. The.params
however is empty (params: null
). This in turn leads me to believe that the code crashes onhrows = tbl.params.row_highlight
(VM112:9 Uncaught TypeError: Cannot read property 'row_highlight' of null at eval (eval at window.HTMLWidgets.evaluateStringMember (htmlwidgets.js:732), <anonymous>:9:28)
).Has anyone encountered sth like this before and is able to help out?
Take care,
-Stefan
The text was updated successfully, but these errors were encountered: