ui <- fluidPage(
# Application title
# titlePanel("Old Faithful Geyser Data"),
mainPanel(
rHandsontableOutput('table'),
br(),
submitButton("Apply changes"),
verbatimTextOutput('selected')
)
)
server <- function(input, output) {
data1 = read.csv("SampleCSVFile_2kb.csv", TRUE,",")
output$table = renderRHandsontable(rhandsontable(data1, width = 1000, height = 250))
output$selected=renderPrint({
cat('\nChanged Cell Old Value:',input$table$changes$changes[[1]][[3]])
cat('\nChanged Cell New Value:',input$table$changes$changes[[1]][[4]])
})
}
shinyApp(ui = ui, server = server)
0
A
回答
1
據我所知,當你按下提交按鈕時,你想訪問你服務器內的rhandsontable輸入。 在下面的示例中,我修改了代碼,以便在tableoutput
中顯示更新的rhandsontable。
library(shiny)
library(rhandsontable)
ui <- fluidPage(
# Application title # titlePanel("Old Faithful Geyser Data"),
mainPanel(
rHandsontableOutput('table'),
br(),
submitButton("Apply changes"),
verbatimTextOutput('selected'),
##The updated table output
rHandsontableOutput('tableoutput')
)
)
server <- function(input, output) {
data1 = read.csv("SampleCSVFile_2kb.csv", TRUE,",")
output$table = renderRHandsontable(rhandsontable(data1, width = 1000, height = 250))
output$selected=renderPrint({
cat('\nChanged Cell Old Value:',input$table$changes$changes[[1]][[3]])
cat('\nChanged Cell New Value:',input$table$changes$changes[[1]][[4]])
})
observe(
if(!is.null(input$table)){
output$tableoutput = renderRHandsontable(rhandsontable(hot_to_r(input$table), width = 1000, height = 250))
}
)
}
shinyApp(ui = ui, server = server)
希望它有幫助!
+0
它工作。謝謝@SBista。你能解釋hot_to_r函數嗎? –
+0
@Ishanmahajan'hot_to_r'函數用於將rhandsontable對象轉換爲R對象(數據框)。 – SBista
相關問題
- 1. 如何使用一個提交按鈕更新2個表單
- 2. 我已經在php中創建了一個按鈕。我想調用函數那個按鈕
- 3. Flask&WTForms:如何使用多個提交按鈕創建表單?
- 4. 使用已經動態創建的javascript提交表單
- 5. 如何用函數創建一個按鈕,然後使用jQuery提交它?
- 6. 如何做一個已經提交表格數據的Barplot?
- 7. 使用HTML表單的上一個按鈕在PHP中提交
- 8. 提交一個php表單和一個按鈕的javascript函數
- 9. 表單上的Javascript新按鈕提交
- 10. 提交按鈕在表格數據下呈現。我只需要一個表單提交按鈕
- 11. 我已經創建了SQL 3個表使用加入
- 12. 如何用多個提交按鈕創建表單
- 13. 如何在HTML上創建一個工作提交按鈕?
- 14. 如何使用AJAX提交一個提交按鈕的3個表單
- 15. 在phpMyAdmin中創建一個新表格,但單擊HTML中的提交按鈕
- 16. 如何使用arc4random函數創建上一個/後退按鈕?
- 17. 如何使用單個提交按鈕提交表單?
- 18. 如何使用提交按鈕提交單個表單元素?
- 19. 在Microsoft Access的註冊表單上創建一個提交按鈕
- 20. 表格上的多個提交按鈕
- 21. 我想創建一個按鈕,添加一個新的表單
- 22. 如果提交按鈕的名稱已提交,我該如何驗證並使用jQuery提交表單?
- 23. iphone表視圖 - 我已經創建了一個按鈕,並把它放在一個表格單元格內按鈕內的表格單元格
- 24. 我的函數重新創建一個cookie,即使它已經存在
- 25. CSS:爲什麼我的表單在新行上提交按鈕?
- 26. 如何使用JavaScript一鍵提交按鈕提交HTML中的兩個表單?
- 27. 如何創建數據表單提交按鈕?
- 28. JavaScript表單提交的表單包含一個提交按鈕
- 29. 如何在已經有記錄的表上創建行計數?
- 30. 如何在我已經做出更改的舊提交中創建分支?
你的意思是你想更新'input $ table'?目前還不清楚你實際想要更新什麼。你能否詳述一下你想達到的目標? – SBista
是的,確切地說。我想更新輸入$表。 –