jrowen/rhandsontable

Show different colHeaders than are used internally/in the code

LogFlames opened this issue · 1 comments

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.

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)