INWTlab / shinyMatrix

https://inwtlab.github.io/shinyMatrix/
Other
19 stars 6 forks source link

Bug when using extend feature for rows in the matrix #21

Closed lgirola closed 3 years ago

lgirola commented 3 years ago

UPDATE 03 June 2023: this bug still persists in version 6.0. However a hackish workaround is setting matrix columns extend to TRUE even if you don't need to extend columns, and set the extension delta to 0, like this: matrixInput(... cols = list(extend = TRUE, delta = 0, ...) ...). This takes care of the problem for me.

Hi, shinyMatrix really fits my needs. Thank you for this! Perhaps I´m not using the app correctly, or maybe it´s a bug. But when I use the extend feature for inserting additional rows into a matrix, it only works if I click on the right-most field of the new row. If I click on any other field (to the left of the right-most) of the new row, then the matrix is left with invalid fields in that row and there´s no way to go back and fix it other than starting all over again. Below is the code I´m using. I also screen shot an example of what happens when I click on any column other than the right-most: a successful row insertion is shown in blue, an unsuccessful row insertion shown in red.

library(shinyMatrix)
m <- diag(5)
colnames(m) <- 1:5
rownames(m) <- letters[1:5]

ui <- fluidPage(
        titlePanel("Demonstration Matrix Input Field"),
        fluidRow(
          column(6, matrixInput(
                      inputId = "matrix",
                      label = "Default matrix",
                      value = m,
                      class = "numeric",
                      cols = list(names = TRUE),
                      rows = list(extend = TRUE,names = TRUE) # change "extend" to TRUE
                    )
          ),
          column(6, tableOutput("table"))
        )
      )

server <- function(input, output, session) {
            output$table <- renderTable(input$matrix, rownames = TRUE)
          }

shinyApp(ui, server)

Attached image: shinyMatrix

aneudecker commented 3 years ago

Hi @lgirola,

glad to hear that the package is used!

We did some major restructuring for version 0.5.0 to make the JavaScript part more maintainable. This probably introduced this bug. Thanks for your detailed report, I will look into it

aneudecker commented 3 years ago

@lgirola The new version 0.6.1 on GitHub should solve your problem. It will eventually find its way to CRAN. Until then you can install the version from GitHub using devtools::install_github('INWTlab/shiny-matrix')

lgirola commented 3 years ago

Hi Andreas,

I just downloaded the new version 0.6.1 as instructed, but the issue persists when I run it. (Btw I uninstalled the prior version of shinyMatrix first, then installed 0.6.1).

In summary, when using the extend feature for additional row inputs (an extremely handy feature), I have to click on the right-most field first before inserting any values in the fields to the left of it. If I first click on any new field to the left of the right-most field, all fields to the right disappear and are no longer available for data entry. Ideally, one should be able to click on any new field for inserting data.

Kind regards,

L. Girola

-- Sent with Tutanota, the secure & ad-free mailbox: https://tutanota.com

May 21, 2021, 08:29 by @.***:

@lgirola https://github.com/lgirola> The new version 0.6.1 on GitHub should solve your problem. It will eventually find its way to CRAN. Until then you can install the version from GitHub using > devtools::install_github('INWTlab/shiny-matrix')

— You are receiving this because you were mentioned. Reply to this email directly, > view it on GitHub https://github.com/INWTlab/shiny-matrix/issues/21#issuecomment-845692207> , or > unsubscribe https://github.com/notifications/unsubscribe-auth/AUEZ553V32ZSZSWHLSOQISTTOX4TPANCNFSM45HQAZWQ> .

aneudecker commented 3 years ago

@lgirola did you try clearing the browser cache? Maybe there is an old JavaScript file being used

lgirola commented 3 years ago

Ahhhh yes that fixed it! Clearing the cache worked. Thank you so much for your prompt responses and resolutions. I really need this package, perfectly fits my needs.

nanxstats commented 2 years ago

Is it possible that we do a CRAN submission anytime soon? This seems to be a critical issue affecting a major feature of the widget. Thanks!