DT
DT copied to clipboard
What is `selectPage` supposed to do? Or how to use it?
Hello,
I recently tried to use selectPage, e.g. selectPage(proxy, 2), but this had no effect. I expected it would make the table jump to page 2.
By filing an issue to this repo, I promise that
- [ x] I have fully read the issue guide at https://yihui.name/issue/.
- [ x] I have provided the necessary information about my issue.
- If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
- If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included
xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/DT'). - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- [ x] I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
Ah no, this works, but not at the start-up.
- This works:
library(shiny)
library(DT)
ui <- fluidPage(
br(), br(),
actionButton("go", "Go"),
br(), br(),
DTOutput("dtable")
)
server <- function(input, output, session) {
output[["dtable"]] <- renderDT({
datatable(iris)
})
proxy <- dataTableProxy("dtable")
observeEvent(input[["go"]], {
selectPage(proxy, 3)
})
}
shinyApp(ui, server)
- This does not work:
library(shiny)
library(DT)
ui <- fluidPage(
br(), br(),
DTOutput("dtable")
)
server <- function(input, output, session) {
output[["dtable"]] <- renderDT({
datatable(iris)
})
proxy <- dataTableProxy("dtable")
selectPage(proxy, 3)
}
shinyApp(ui, server)
Ah no, this works, but not at the start-up.
Perhaps the table is not ready to be manipulated by the proxy yet. I'm not sure if this is a bug or not.
Not sure too, but selectRow does work at the startup.
Hmm, that's interesting...