Unable to move table rows in shiny r

0 votes

I have a simple shiny r app. 

library(shiny)
library(DT)
iris2 = head(iris, 30)
server <- function(input, output) {
    output$tb <-DT::renderDataTable(server=FALSE,{
        datatable(
            iris2,
            colnames = c(colnames(iris2)), extensions = 'RowReorder',
            options = list(rowReorder = TRUE))
    })
}
ui <- fluidPage(dataTableOutput('tb', width = '200px', height = '200px'))
shinyApp(ui, server)

But when I try to adjust the table row only the first column changes

Dec 5, 2018 in Data Analytics by Ali
• 10,400 points
43 views

1 answer to this question.

0 votes
Try this:
library(shiny)
library(DT)

iris2 = head(iris, 30)
server <- function(input, output) {
  output$tb <-DT::renderDataTable(server=FALSE,{
    datatable(
      iris2,
      colnames = c(colnames(iris2)), extensions = 'RowReorder',
      options = list(order = list(list(0, 'asc')), rowReorder = TRUE))
  })
}

ui <- fluidPage(dataTableOutput('tb', width = '200px', height = '200px'))

shinyApp(ui, server)
answered Dec 5, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

0 votes
1 answer

Unable to install the 'devtools' package in R

Run the below command in your Ubuntu/Linux ...READ MORE

answered Jun 6, 2018 in Data Analytics by Bharani
• 4,550 points
565 views
0 votes
1 answer

How to convert a sentence to word table in R?

Try the following code: sentence <- c("case sweden", ...READ MORE

answered Jun 21, 2018 in Data Analytics by darklord
• 6,140 points
23 views
0 votes
1 answer

How to reduce the height of valueBox in shiny R?

Add this line before using your vlaueBoxes tags$head(tags$style(HTML(".small-box ...READ MORE

answered Dec 4, 2018 in Data Analytics by Haseeb
351 views
0 votes
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,040 points
387 views
0 votes
1 answer

Error saying "could not find function dashboardPage" in shiny R

Include this line in the code: Library(shinydashboard) READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,040 points
219 views