I have the shiny app below in which I click on datatable row and display its index next to it. Is it possible to press the Next button and display the index of the next row? The table's next row will be highlighted accordingly everytime as well.
library(shiny) library(DT) shinyApp( ui = fluidPage( title = 'Select Table Rows', h1('A Server-side Table'), fluidRow( column(9, DT::dataTableOutput('x3')), column(3, verbatimTextOutput('x4')), actionButton("next","Next row") ) ), server = function(input, output, session) { # server-side processing mtcars2 = mtcars[, 1:8] output$x3 = DT::renderDataTable({datatable(selection = list(target = "row", mode = "single"),mtcars2 )}) # print the selected indices output$x4 = renderPrint({ s = input$x3_rows_selected if (length(s)) { cat('These rows were selected:\n\n') cat(s, sep = ', ') } }) }) https://stackoverflow.com/questions/65729838/move-to-the-next-row-of-the-selected-one-in-a-dtdatatable-with-the-use-of-an-a January 15, 2021 at 10:53AM
没有评论:
发表评论