r - DT:datatableAjax 卡在“处理中...” Server=False 工作正常
问题描述
我无法弄清楚我的问题是什么。下面的代码不起作用,并且数据表卡Processing...
在浏览器控制台警告中显示:
“加载资源失败:服务器响应状态为 400(错误请求)”
在服务器上:
output$dt <- DT::renderDataTable({
dtdf <- data1()[,-13:-14] %>%
mutate(Action = paste('<a class="go-map" href="" data-lat="', Latitude, '" data-long="', Longitude, '" data-zip="', ID, '"><i class="glyphicon glyphicon-pushpin"></i></a>', sep=""))
action <- DT::dataTableAjax(session, dtdf)
DT::datatable(dtdf, extensions = 'Buttons', options = list(ajax = list(url = action), dom = 'Bfrtip', buttons = c('excel', 'pdf'), pageLength = 25, columnDefs = list(list(className = 'dt-center', targets ="_all"))), escape = FALSE)
})
在用户界面上:
DT::dataTableOutput("dt")
只需更改为 option server=FALSE
,如下所示,即可按预期工作。但是,我的数据集太大而无法禁用服务器端处理。
output$dt <- DT::renderDataTable({
dtdf <- data1()[,-13:-14] %>%
mutate(Action = paste('<a class="go-map" href="" data-lat="', Latitude, '" data-long="', Longitude, '" data-zip="', ID, '"><i class="glyphicon glyphicon-pushpin"></i></a>', sep=""))
action <- DT::dataTableAjax(session, dtdf)
DT::datatable(dtdf, extensions = 'Buttons', options = list(ajax = list(url = action), dom = 'Bfrtip', buttons = c('excel', 'pdf'), pageLength = 25, columnDefs = list(list(className = 'dt-center', targets ="_all"))), escape = FALSE)
}, server = FALSE)
我究竟做错了什么?
解决方案
对于有类似问题的任何人,请尝试安装最新版本!
全新安装的 DTdevtools::install_github('rstudio/DT')
似乎为我解决了这个问题!
推荐阅读
- python - 在 Python 代码中捆绑第三方 .exe 并生成另一个可移植的 .exe
- sql-server - 返回包含特殊字符的字符串
- python - 将 Python Flask Web API 部署到 Azure 门户时出现依赖性问题
- javascript - AngularJS - 将数据推送到数组时未更新 ng-repeat 和绑定
- c++ - c_str() 与 data() 在返回类型方面
- sql - Ms Access Query 允许空行
- tensorflow - 为什么在我自己的数据集上使用 ssd_mobilenet_v1_pnp 的结果很差?
- python - XML 格式不正确
- python - Python:查找任意曲线的拟合参数数量
- javascript - 使用基于复选框的 javascript更改/附加 html标记属性