RinteRface / argonDash

argon dashboard template
https://rinterface.github.io/argonDash/
138 stars 37 forks source link

Create multiple rows in argonTable #34

Open CyprienCambus opened 2 years ago

CyprienCambus commented 2 years ago

Hi everyone,

I've tried to insert many rows in argonTable and I found a solution which is the following:

1) In a script, I format the dataframe by using this piece of code:

library(argonDash)
library(argonR)
mtcars$car <- rownames(mtcars)

paste_items <- function(row){
  paste("argonTableItems(argonTableItem('", mtcars[row,"car"],"'), argonTableItem(dataCell = TRUE,",  mtcars[row,"mpg"], "))", sep = "")
}

res <- parse(text = sapply(c(1:nrow(mtcars)), function(i) paste_items(i)))

2) In the app.R I change the output by:

output$argonTable <- renderUI({

      wrap <- if (input$cardWrap == "Enable") TRUE else FALSE

      argonTable(
        cardWrap = wrap,
        headTitles = c(
          "CAR",
          "MPG"
        ),
        lapply(c(1:length(res)), function(i) eval(res[i]))
      )
    })

However it would be nice to have multiple pages instead of a single page. Any ideas?

Thanks