2017-05-09 5 views

答えて

0

あなたはほど、あなたのテーブルにいくつかのstyleを追加することができます。

library(shiny) 
library(rhandsontable) 

ui <- fluidPage(
    rHandsontableOutput("table1"), 
    tags$style(type="text/css", "#table1 th {font-weight:bold;}") 
) 

server=function(input, output, session) { 

    output$table1 <- renderRHandsontable({ 
    rhandsontable(mtcars,rowHeaders=F) 
    }) 
} 

shinyApp(ui,server) 

enter image description here

+0

素晴らしい!ありがとうございました – Sumeda

0

rhandsontableはHandsontable.jsライブラリへのインターフェイスなので、CSSを使用してカスタマイズすることができます。

DF = data.frame(column.one = 1:10, 
       column.two = TRUE) 

rhandsontable(DF) 

カスタマイズをしないと、thisのように見えます。

しかし、あなたはCSSを使用して指定した場合、あなたはそれを参照することができます。

DF = data.frame(column.one = 1:10, 
       column.two = TRUE) 

func = "function (col) { # custom CSS 
    switch (col) { 
    case 0: 
     return '<b>Bold</b> and <em>Italics</em>'; 

    case 1: 
     return '<em>Bold</em> and <b>Italics</b>'; 
    } 
}" 

rhandsontable(DF, colHeaders = htmlwidgets::JS(func)) 

そして、あなたはthisで終わります。

rhandsontable関数を呼び出すときには、必ずcolHeaders引数を指定してください。

+0

それは動作しません:( – Sumeda

+0

をこれが私のコード – Sumeda

+0

ライブラリである(光沢) ライブラリ(データセット) ライブラリー( rhandsontable) UI = fluidPageを( BR()、BR()、actionButton( "更新"、 "行く"、クラス= "成功")、BR()、BR()、 rHandsontableOutput( "タブLE1" ) ) サーバ=関数(入力、出力、セッション){ MT =反応({ datacopy = data.table(mtcars) datacopy [16、 "WT"] < - NA datacopy }) 出力$ TABLE1 = renderRHandsontable({ rhandsontable(MT()) }) } shinyApp(UI、サーバー) – Sumeda

関連する問題