columnSorting = True 当列标题在 rhandsontable 上旋转时工作很奇怪

问题描述

对于我的表格的特征,我需要旋转列的标题并启用列排序功能

我发现旋转标题的唯一方法是更改​​列标题名称添加 div 标签并向该标签添加 css 样式以旋转文本。这是复制这种情况的片段:

library(shiny)
library(rhandsontable)

ui = fluidPage(
  tags$style(
    type="text/css"," .rotate{
            transform: translate(0px,35px) rotate(315deg);
      }"
  ),rHandsontableOutput('test')
)

server = function(input,output,session) {
  tst = data.frame(
    'column 1'=c(1,2,3,4,5),'column 2'=c(5,1)
  )
  
  tstHeaders = sapply(
    colnames(tst),function(x) paste0("<div class='rotate'> ",x," </div>")
  )
  
  output$test <- renderRHandsontable({
    rhandsontable(tst,colHeaders = unname(tstHeaders),readOnly = TRUE,manualColumnResize = TRUE,columnHeaderHeight = 100,columnSorting = TRUE) 
  })
}

the expected behaviour is sorting the table clicking on the headers

但实际行为是单击列标题没有区别,如果您想对值进行排序,则需要单击标题的顶部区域 click on the top region of the header

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)