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

Support for shiny input in colDef(cell = function(i) {...}) #390

Open
eheinzen opened this issue Aug 16, 2024 · 1 comment
Open

Support for shiny input in colDef(cell = function(i) {...}) #390

eheinzen opened this issue Aug 16, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@eheinzen
Copy link

eheinzen commented Aug 16, 2024

In #89 you mentioned that Shiny inputs are not yet supported in the cell definition, but are supported in the details. I've got a use case where I want the rows of my table to have a numericInput associated with them, but I don't want to put it in the details section. Any chance reactable could support that?

I'm looking into a workaround with Javascript for now, but I'm definitely no JS expert...


UPDATE: If I put the reactable() in my UI, Shiny does recognize the numericInputs in my cells. It's only if I call renderReactable() from my server that it doesn't.

@glin glin added the enhancement New feature or request label Aug 26, 2024
@glin
Copy link
Owner

glin commented Aug 26, 2024

Yeah, this is still on the to-do list somewhere. The last update was at #345 (comment), where I felt like it wouldn't be a common enough use case. Another issue was that it'd probably incur a performance cost to look for and re-bind Shiny inputs on every table change, even if there weren't any Shiny inputs present. I was thinking about making this more of an opt-in feature where you'd need to mark which cells could contain Shiny input/outputs.

For now, a possibility could be to use Reactable.onStateChange() to re-bind Shiny inputs on every table change manually.

This would be something like:

Reactable.onStateChange('table-id', state => {
  Shiny.unbindAll()
  Shiny.bindAll()
})

I haven't tested this, so I'm not 100% sure it'll work.

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

No branches or pull requests

2 participants