[英]How to have an editable DT table when using Flexdashboard with shiny?
我不知道這是否是最好的方法,但非常感謝任何指導。 我有一張桌子,我將在我的一個 flexdashboard 中顯示應用程序。 此表顯示 ID、接收日期和空白狀態。
我想讓用戶在那里 go 並在他們看到應用程序后輸入一個狀態並將該狀態保存在表中。 我可以使用 editable=TRUE 執行此操作,但是當我重新加載 shiny 應用程序時它不會保存。
最好的方法是什么?
Code
---
title: "CARS TABLE "
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
library(DT)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
data <- data.frame(id = c(12456,12457,12458,12459,12569,23456),
date_recived = c("10/25/2021", "10/05/2021","11/25/2021","11/25/2021","11/25/2021","10/22/2021"),
status = c("","","","","",""))
datatable(data
,
editable = TRUE,
options = list(
columnDefs = list(list(className = 'dt-center', targets = "_all")))
)
```
為了保存用戶輸入,您需要一個服務器端進程,該進程將與數據庫系統交互(讀取和寫入)或寫入系統上的文件。
事情是,根據定義, {flexdashboard}
是一個沒有服務器端進程的 HTML 文件,因此就您的示例而言,沒有本地方法可以使用{flexdashboard}
執行此操作。
您的解決方案是:
{shiny}
應用程序。{plumber}
or straight in NodeJS), then do a call in JavaScript from your HTML file. 例如https://api.jquery.com/jquery.post/ 。科林
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.