[英]How to have an editable DT table when using Flexdashboard with shiny?
I don't know if this is the best approach, but any guidence is greatly appreciated.我不知道这是否是最好的方法,但非常感谢任何指导。 I have a table that in one of my flexdashboard's I will show applications.
我有一张桌子,我将在我的一个 flexdashboard 中显示应用程序。 This table shows ID, date recieved, and a status which is blank.
此表显示 ID、接收日期和空白状态。
I would like for a user to go in there and enter a status once they see application and have that status be saved in the table.我想让用户在那里 go 并在他们看到应用程序后输入一个状态并将该状态保存在表中。 I can do this with the editable=TRUE but it doesn't save when I reload my shiny app.
我可以使用 editable=TRUE 执行此操作,但是当我重新加载 shiny 应用程序时它不会保存。
What is the best approach for this?最好的方法是什么?
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")))
)
```
In order to save user inputs, you'll need a server side process that would interact (read and write) with a database system or write to a file on the system.为了保存用户输入,您需要一个服务器端进程,该进程将与数据库系统交互(读取和写入)或写入系统上的文件。
Things is, {flexdashboard}
is by definition an HTML file without a server side process, so as far as your example goes, there is no native way to do this with {flexdashboard}
.事情是,根据定义,
{flexdashboard}
是一个没有服务器端进程的 HTML 文件,因此就您的示例而言,没有本地方法可以使用{flexdashboard}
执行此操作。
Your solutions are:您的解决方案是:
{shiny}
app.{shiny}
应用程序。{plumber}
or straight in NodeJS), then do a call in JavaScript from your HTML file. {plumber}
or straight in NodeJS), then do a call in JavaScript from your HTML file. For example with https://api.jquery.com/jquery.post/ . Colin科林
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.