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

Show different colHeaders than are used internally/in the code #428

Open
LogFlames opened this issue Jun 14, 2023 · 1 comment
Open

Show different colHeaders than are used internally/in the code #428

LogFlames opened this issue Jun 14, 2023 · 1 comment

Comments

@LogFlames
Copy link

Hi,

I wonder if this is possible to do/feature request:

I would like to show the user(/on the webpage) different names for the columns than the code uses.
For example, if I have a data frame with

DF <- data.frame(weight = 1:10, age = 2:11)
rhandsontable(DF)

The user is shown those names (weight and age). I would like to have something like the following:

DF <- data.frame(weight = 1:10, age = 2:11)
rhandsontable(DF, colHeaders = c("Weight (g)", "Age (years)"))

But in this case, these names are returned by hot_to_r(input$hot) aswell and cannot be used by the rest of the code.

@LogFlames
Copy link
Author

I solved it using a htmlwidget callback

  hot <- htmlwidgets::onRender(hot, "
    function(el, x, data) {
      var hot = this.hot;
      hot.updateSettings({'colHeaders': data});
    }
  ", data = colheaders)

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

1 participant