Я не уверен, почему ваша таблица делится на align="center"
;может быть, это то, что вы должны опубликовать здесь .
Тем не менее, здесь есть обходной путь с использованием offset
:
library(shiny)
library(rhandsontable)
# Create initial data frames
x1 <- data.frame(v1 = c(1, 2), v2 <- c(3, 4))
# Server
server <- shinyServer(function(input, output, session) {
# Data frame 1 to hot
previousX1 <- reactive({
x1
})
changeX1 <- reactive({
if (is.null(input$hot_x1)) {
return(previousX1())
}
else{
X1 <- as.data.frame(hot_to_r(input$hot_x1))
# Perform some operations on X1
}
})
output$hot_x6 <- output$hot_x5 <- output$hot_x4 <- output$hot_x3 <- output$hot_x2 <- output$hot_x1 <- renderRHandsontable({
rhandsontable(changeX1())
})
})
# User interface
ui <- shinyUI(fluidPage(navbarPage(
"MWE",
tabPanel("Center",
fluidRow(
column(
width = 12,
align = "center",
"Alignment (center) with split"
)
),
fluidRow(
column(
width = 6,
align = "center",
rHandsontableOutput("hot_x1")
),
column(
width = 6,
align = "center",
rHandsontableOutput("hot_x2")
)
)),
tabPanel("Left",
fluidRow(
column(
width = 12,
align = "center",
"Alignment (left) without split"
)
),
fluidRow(
column(width = 6, rHandsontableOutput("hot_x3")),
column(width = 6, rHandsontableOutput("hot_x4"))
)),
tabPanel("Offset",
fluidRow(
column(
width = 12,
align = "center",
"column offset without split"
)
),
fluidRow(
column(
width = 4,
offset = 2,
rHandsontableOutput("hot_x5")
),
column(
width = 4,
offset = 2,
rHandsontableOutput("hot_x6")
)
)),
fluid = TRUE
)))
shinyApp(ui = ui, server = server)