[英]Datatable (DT) Shiny R - select all found rows
I have a question about datatable (DT) which i am using in Shiny. 我有一个关于在Shiny中使用的数据表(DT)的问题。 I got quite big data (>5000000 rows), and i display it in shiny app using datatable (DT) with filters.
我有相当大的数据(> 5000000行),并使用带有过滤器的数据表(DT)在闪亮的应用程序中显示它。 Depending on the user preferences for filtering, lets assume it gives us 550 rows (but it can give us more or less than that).
根据用户对过滤的偏好,让我们假设它可以给我们550行(但可以给我们更多或更少的行)。 Because of pagination I am not able to see all 550 rows (assuming pageLength is 100) or whats even worse, i am not able to display all filtered rows further in a plot, as function
input$tabelle_rows_all
uses the rows on the current page (i must first change the entries number). 由于分页,我无法看到所有550行(假设pageLength为100),甚至更糟的是,由于函数
input$tabelle_rows_all
使用当前页面上的行,因此我无法在图表中进一步显示所有过滤的行(我必须先更改条目号)。 Is there any way to get all found rows after filtering datatable (not depended on pageLength
)? 有什么方法可以在过滤数据表后获取所有找到的行 (不依赖于
pageLength
)?
Example: 例:
library(shiny)
library(DT)
library(ggplot2)
x <- as.numeric(1:1000000)
y <- as.numeric(1:1000000)
data <- data.frame(x,y)
shinyApp(
ui = fluidPage(dataTableOutput('tableId'),
plotOutput('plot1')),
server = function(input, output) {
output$tableId = renderDataTable({
datatable(data, options = list(pageLength = 100, lengthMenu=c(100,200,300,400,500,600)))
})
output$plot1 = renderPlot({
filtered_data <- data[input$tableId_rows_all, ]
ggplot(data=filtered_data, aes(x=x,y=y)) + geom_line()
})
}
)
Thanks for any Info 感谢您的任何信息
Are you sure it's not working already? 您确定它已经不起作用了吗? As of version 0.0.65, you should have the following:
从0.0.65版本开始,您应该具有以下功能:
input$tableId_rows_current: the indices of rows on the current page
input $ tableId_rows_current:当前页面上的行的索引
input$tableId_rows_all: the indices of rows on all pages (after the table is filtered by the search strings)input $ tableId_rows_all:所有页面上的行的索引(在表被搜索字符串过滤之后)
From the DT documentation从DT文档
I'm using tableId_rows_all in a dashboard for exactly this and it is working. 我正在仪表板中使用tableId_rows_all来解决这个问题,它正在工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.